Add semaphore tests, fix sem_destroy.

Bug: https://code.google.com/p/android/issues/detail?id=76088
Change-Id: I4a0561b23e90312384d40a1c804ca64ee98f4066
This commit is contained in:
Elliott Hughes
2014-09-18 16:11:59 -07:00
parent adc01348ee
commit 04303f5a8a
17 changed files with 567 additions and 550 deletions

View File

@@ -25,6 +25,7 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _SEMAPHORE_H
#define _SEMAPHORE_H
@@ -32,6 +33,8 @@
__BEGIN_DECLS
struct timespec;
typedef struct {
volatile unsigned int count;
#ifdef __LP64__
@@ -41,20 +44,18 @@ typedef struct {
#define SEM_FAILED NULL
extern int sem_init(sem_t *sem, int pshared, unsigned int value);
int sem_destroy(sem_t*);
int sem_getvalue(sem_t*, int*);
int sem_init(sem_t*, int, unsigned int);
int sem_post(sem_t*);
int sem_timedwait(sem_t*, const struct timespec*);
int sem_trywait(sem_t*);
int sem_wait(sem_t*);
extern int sem_close(sem_t *);
extern int sem_destroy(sem_t *);
extern int sem_getvalue(sem_t *, int *);
extern int sem_init(sem_t *, int, unsigned int);
extern sem_t *sem_open(const char *, int, ...);
extern int sem_post(sem_t *);
extern int sem_trywait(sem_t *);
extern int sem_unlink(const char *);
extern int sem_wait(sem_t *);
struct timespec;
extern int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout);
/* These aren't actually implemented. */
sem_t* sem_open(const char*, int, ...);
int sem_close(sem_t*);
int sem_unlink(const char*);
__END_DECLS