/external/libvpx/libvpx/vp8/common/ |
D | threading.h | 93 #define sem_init(sem, sem_attr1, sem_init_value) \ argument 94 (int)((*sem = CreateSemaphore(NULL, 0, 32768, NULL)) == NULL) 95 #define sem_wait(sem) \ argument 96 (int)(WAIT_OBJECT_0 != WaitForSingleObject(*sem, INFINITE)) 97 #define sem_post(sem) ReleaseSemaphore(*sem, 1, NULL) argument 98 #define sem_destroy(sem) \ argument 99 if (*sem) ((int)(CloseHandle(*sem)) == TRUE) 110 static inline int sem_init(sem_t *sem, int pshared, unsigned int value) { 111 DosCreateEventSem(NULL, &sem->event, pshared ? DC_SEM_SHARED : 0, 113 DosCreateMutexSem(NULL, &sem->wait_mutex, 0, FALSE); [all …]
|
/external/syslinux/core/lwip/src/arch/ |
D | sys_arch.c | 11 err_t sys_sem_new(sys_sem_t *sem, u8_t count) in sys_sem_new() argument 13 if (!sem) in sys_sem_new() 15 *sem = malloc(sizeof(struct semaphore)); in sys_sem_new() 16 if (!*sem) in sys_sem_new() 19 sem_init(*sem, count); in sys_sem_new() 23 void sys_sem_free(sys_sem_t *sem) in sys_sem_free() argument 25 if (!!sem && !!*sem) { in sys_sem_free() 26 sys_sem_set_invalid(sem); in sys_sem_free() 27 free(*sem); in sys_sem_free() 28 *sem = NULL; in sys_sem_free() [all …]
|
/external/syslinux/core/thread/ |
D | semaphore.c | 4 void sem_init(struct semaphore *sem, int count) in sem_init() argument 6 if (!!sem) { in sem_init() 7 sem->list.next = sem->list.prev = &sem->list; in sem_init() 8 sem->count = count; in sem_init() 12 mstime_t __sem_down_slow(struct semaphore *sem, mstime_t timeout) in __sem_down_slow() argument 19 if (!sem_is_valid(sem)) { in __sem_down_slow() 21 } else if (sem->count >= 0) { in __sem_down_slow() 26 sem->count++; in __sem_down_slow() 36 block.semaphore = sem; in __sem_down_slow() 44 block.list.prev = sem->list.prev; in __sem_down_slow() [all …]
|
/external/deqp/framework/delibs/dethread/unix/ |
D | deNamedSemaphoreUnix.c | 39 static void NamedSemaphore_getName (const NamedSemaphore* sem, char* buf, int bufSize) in NamedSemaphore_getName() argument 41 deSprintf(buf, bufSize, "/desem-%d-%p", getpid(), (void*)sem); in NamedSemaphore_getName() 48 NamedSemaphore* sem = (NamedSemaphore*)deCalloc(sizeof(NamedSemaphore)); in deSemaphore_create() local 54 if (!sem) in deSemaphore_create() 57 NamedSemaphore_getName(sem, name, DE_LENGTH_OF_ARRAY(name)); in deSemaphore_create() 59 sem->semaphore = sem_open(name, O_CREAT|O_EXCL, mode, initialValue); in deSemaphore_create() 61 if (sem->semaphore == SEM_FAILED) in deSemaphore_create() 63 deFree(sem); in deSemaphore_create() 67 return (deSemaphore)sem; in deSemaphore_create() 72 NamedSemaphore* sem = (NamedSemaphore*)semaphore; in deSemaphore_destroy() local [all …]
|
D | deSemaphoreUnix.c | 36 sem_t* sem = (sem_t*)deMalloc(sizeof(sem_t)); in deSemaphore_create() local 41 if (!sem) in deSemaphore_create() 44 if (sem_init(sem, 0, (unsigned int)initialValue) != 0) in deSemaphore_create() 46 deFree(sem); in deSemaphore_create() 50 return (deSemaphore)sem; in deSemaphore_create() 55 sem_t* sem = (sem_t*)semaphore; in deSemaphore_destroy() local 56 DE_ASSERT(sem); in deSemaphore_destroy() 57 sem_destroy(sem); in deSemaphore_destroy() 58 deFree(sem); in deSemaphore_destroy() 63 sem_t* sem = (sem_t*)semaphore; in deSemaphore_increment() local [all …]
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/ |
D | 2-2.c | 91 sem_t *sem; in common() local 94 sem = sem_open(SEM_NAME, 0); in common() 96 if (sem == SEM_FAILED) { in common() 103 ret = sem_wait(sem); in common() 119 ret = sem_post(sem); in common() 125 return sem; in common() 134 sem_t *sem; in main() local 140 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main() 142 if ((sem == SEM_FAILED) && (errno == EEXIST)) { in main() 144 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main() [all …]
|
D | 7-1.c | 103 sem_t *sem; in main() local 109 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 1); in main() 111 if ((sem == SEM_FAILED) && (errno == EEXIST)) { in main() 113 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 1); in main() 116 if (sem == SEM_FAILED) { in main() 121 ret = pthread_create(&thread, NULL, threaded, sem); in main() 138 ret = sem_post(sem); in main() 152 ret = sem_close(sem); in main()
|
D | 9-1.c | 110 sem_t *sem; in main() local 116 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main() 118 if ((sem == SEM_FAILED) && (errno == EEXIST)) { in main() 120 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main() 123 if (sem == SEM_FAILED) { in main() 128 ret = pthread_create(&child, NULL, threaded, sem); in main() 154 ret = sem_post(sem); in main() 168 ret = sem_close(sem); in main()
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_close/ |
D | 3-2.c | 94 sem_t *sem; in main() local 100 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 2); in main() 102 if (sem == SEM_FAILED && errno == EEXIST) { in main() 104 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 2); in main() 107 if (sem == SEM_FAILED) { in main() 113 ret = sem_wait(sem); in main() 121 ret = sem_close(sem); in main() 128 sem = sem_open(SEM_NAME, O_CREAT, 0777, 3); in main() 130 if (sem == SEM_FAILED) { in main() 135 ret = sem_getvalue(sem, &value); in main() [all …]
|
/external/valgrind/memcheck/tests/ |
D | err_disable4.c | 30 sem_t sem; variable 32 sem_t *sem; variable 54 int r = sem_wait(&sem); assert(!r); in child_fn_1() 56 int r = sem_wait(sem); assert(!r); in child_fn_1() 66 int r = sem_wait(&sem); assert(!r); in child_fn_2() 68 int r = sem_wait(sem); assert(!r); in child_fn_2() 90 r = sem_init(&sem, 0, 0); assert(!r); in main() 92 sem = sem_open(semname, O_CREAT, 0777, 0); assert(!(sem == SEM_FAILED)); in main() 108 r = sem_post(&sem); assert(!r); in main() 110 r = sem_post(sem); assert(!r); in main() [all …]
|
/external/autotest/utils/named_semaphore/ |
D | namedsem.c | 30 sem_t *sem; in namedsem_sem_close() local 33 PyArg_ParseTuple(args, "O&", &parse_sem_t, &sem); in namedsem_sem_close() 34 result = sem_close(sem); in namedsem_sem_close() 54 sem_t *sem; in namedsem_sem_wait() local 57 PyArg_ParseTuple(args, "O&", &parse_sem_t, &sem); in namedsem_sem_wait() 58 result = sem_wait(sem); in namedsem_sem_wait() 66 sem_t *sem; in namedsem_sem_post() local 69 PyArg_ParseTuple(args, "O&", &parse_sem_t, &sem); in namedsem_sem_post() 70 result = sem_post(sem); in namedsem_sem_post() 79 sem_t *sem; in namedsem_sem_getvalue() local [all …]
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/ |
D | 8-1.c | 80 sem_t *sem, *sem_1; in child_fn() local 85 sem = sem_open(semname, 0); in child_fn() 86 if (sem == SEM_FAILED) { in child_fn() 102 if (sem_wait(sem) == -1) { in child_fn() 118 sem_t *sem, *sem_1; in main() local 127 sem = sem_open(semname, O_CREAT | O_EXCL, 0777, 1); in main() 128 if (sem == SEM_FAILED) { in main() 150 if (sem_wait(sem) == -1) { in main() 211 sem_post(sem); in main() 216 sem_post(sem); in main() [all …]
|
/external/syslinux/core/include/ |
D | thread.h | 73 #define DECLARE_INIT_SEMAPHORE(sem, cnt) \ argument 74 struct semaphore sem = { \ 77 .next = &sem.list, \ 78 .prev = &sem.list \ 94 static inline void sem_set_invalid(struct semaphore *sem) in sem_set_invalid() argument 96 if (!!sem) in sem_set_invalid() 97 sem->list.next = NULL; in sem_set_invalid() 103 static inline bool sem_is_valid(struct semaphore *sem) in sem_is_valid() argument 105 return ((!!sem) && (!!sem->list.next)); in sem_is_valid()
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/ |
D | 2-1.c | 25 int sem; /* Manual semaphore */ variable 34 sem = 0; in a_cleanup_func() 49 sem = 1; in a_thread_func() 50 while (sem == 1) in a_thread_func() 53 sem = 0; in a_thread_func() 69 sem = 0; in main() 78 while (sem == 0) in main() 87 while (sem == 1) { in main()
|
D | 3-1.c | 38 int sem; variable 53 sem = 0; in a_cleanup_func() 77 sem = 1; in a_thread_func() 78 while (sem == 1) in a_thread_func() 81 sem = 0; in a_thread_func() 102 sem = 0; in main() 120 while (sem == 0) in main() 132 while (sem == 1) { in main()
|
/external/ltp/testcases/kernel/syscalls/move_pages/ |
D | move_pages03.c | 85 void child(void **pages, sem_t * sem) in child() argument 97 if (sem_post(&sem[SEM_CHILD_SETUP]) == -1) in child() 101 if (sem_wait(&sem[SEM_PARENT_TEST]) == -1) in child() 131 sem_t *sem; in main() local 144 sem = alloc_sem(MAX_SEMS); in main() 145 if (sem == NULL) { in main() 158 child(pages, sem); in main() 162 if (sem_wait(&sem[SEM_CHILD_SETUP]) == -1) in main() 176 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main() 181 free_sem(sem, MAX_SEMS); in main()
|
D | move_pages11.c | 85 void child(void **pages, sem_t * sem) in child() argument 97 if (sem_post(&sem[SEM_CHILD_SETUP]) == -1) in child() 101 if (sem_wait(&sem[SEM_PARENT_TEST]) == -1) in child() 131 sem_t *sem; in main() local 144 sem = alloc_sem(MAX_SEMS); in main() 145 if (sem == NULL) { in main() 159 child(pages, sem); in main() 163 if (sem_wait(&sem[SEM_CHILD_SETUP]) == -1) in main() 177 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main() 183 free_sem(sem, MAX_SEMS); in main()
|
D | move_pages05.c | 86 void child(void **pages, sem_t * sem) in child() argument 98 if (sem_post(&sem[SEM_CHILD_SETUP]) == -1) in child() 102 if (sem_wait(&sem[SEM_PARENT_TEST]) == -1) in child() 132 sem_t *sem; in main() local 151 sem = alloc_sem(MAX_SEMS); in main() 152 if (sem == NULL) { in main() 165 child(pages, sem); in main() 169 if (sem_wait(&sem[SEM_CHILD_SETUP]) == -1) in main() 189 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main() 194 free_sem(sem, MAX_SEMS); in main()
|
/external/valgrind/drd/ |
D | drd_pthread_intercepts.c | 1326 int sem_init_intercept(sem_t *sem, int pshared, unsigned int value) in sem_init_intercept() argument 1332 sem, pshared, value, 0, 0); in sem_init_intercept() 1333 CALL_FN_W_WWW(ret, fn, sem, pshared, value); in sem_init_intercept() 1335 sem, 0, 0, 0, 0); in sem_init_intercept() 1340 (sem_t *sem, int pshared, unsigned int value), (sem, pshared, value)); 1344 int sema_init_intercept(sema_t *sem, unsigned int value, int type, void *arg) in sema_init_intercept() argument 1350 sem, type == USYNC_PROCESS ? 1 : 0, in sema_init_intercept() 1352 CALL_FN_W_WWWW(ret, fn, sem, value, type, arg); in sema_init_intercept() 1354 sem, 0, 0, 0, 0); in sema_init_intercept() 1359 (sema_t *sem, unsigned int value, int type, void *arg), [all …]
|
/external/compiler-rt/test/tsan/Darwin/ |
D | gcd-io.mm | 8 dispatch_semaphore_t sem; 25 dispatch_semaphore_signal(sem); 30 dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); 46 dispatch_semaphore_signal(sem); 50 dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); 67 dispatch_semaphore_signal(sem); 72 dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); 87 dispatch_semaphore_signal(sem); 91 dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); 100 sem = dispatch_semaphore_create(0);
|
/external/libmpeg2/common/ |
D | ithread.c | 137 WORD32 ithread_sem_init(void *sem,WORD32 pshared,UWORD32 value) in ithread_sem_init() argument 139 return sem_init((sem_t *)sem,pshared,value); in ithread_sem_init() 142 WORD32 ithread_sem_post(void *sem) in ithread_sem_post() argument 144 return sem_post((sem_t *)sem); in ithread_sem_post() 147 WORD32 ithread_sem_wait(void *sem) in ithread_sem_wait() argument 149 return sem_wait((sem_t *)sem); in ithread_sem_wait() 152 WORD32 ithread_sem_destroy(void *sem) in ithread_sem_destroy() argument 154 return sem_destroy((sem_t *)sem); in ithread_sem_destroy()
|
/external/libhevc/common/ |
D | ithread.c | 129 WORD32 ithread_sem_init(void *sem, WORD32 pshared, UWORD32 value) in ithread_sem_init() argument 131 return sem_init((sem_t *)sem, pshared, value); in ithread_sem_init() 134 WORD32 ithread_sem_post(void *sem) in ithread_sem_post() argument 136 return sem_post((sem_t *)sem); in ithread_sem_post() 139 WORD32 ithread_sem_wait(void *sem) in ithread_sem_wait() argument 141 return sem_wait((sem_t *)sem); in ithread_sem_wait() 144 WORD32 ithread_sem_destroy(void *sem) in ithread_sem_destroy() argument 146 return sem_destroy((sem_t *)sem); in ithread_sem_destroy()
|
/external/compiler-rt/test/sanitizer_common/TestCases/Linux/ |
D | sem_init_glibc.cc | 21 sem_t sem; in my_sem_init() local 22 memset(&sem, 0xAB, sizeof(sem)); in my_sem_init() 23 sem_init(&sem, priv, value); in my_sem_init() 25 char *p = (char *)&sem; in my_sem_init() 29 sem_destroy(&sem); in my_sem_init()
|
/external/libavc/common/ |
D | ithread.c | 140 WORD32 ithread_sem_init(void *sem,WORD32 pshared,UWORD32 value) in ithread_sem_init() argument 142 return sem_init((sem_t *)sem,pshared,value); in ithread_sem_init() 145 WORD32 ithread_sem_post(void *sem) in ithread_sem_post() argument 147 return sem_post((sem_t *)sem); in ithread_sem_post() 151 WORD32 ithread_sem_wait(void *sem) in ithread_sem_wait() argument 153 return sem_wait((sem_t *)sem); in ithread_sem_wait() 157 WORD32 ithread_sem_destroy(void *sem) in ithread_sem_destroy() argument 159 return sem_destroy((sem_t *)sem); in ithread_sem_destroy()
|
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/fork/ |
D | 1-1.c | 59 sem_t *sem; in main() local 79 sem = sem_open(SEM_NAME, O_CREAT, O_RDWR, 0); in main() 80 if (sem == SEM_FAILED) in main() 90 ret = sem_post(sem); in main() 96 ret = sem_close(sem); in main() 106 ret = sem_timedwait(sem, &tsfin); in main() 116 ret = sem_close(sem); in main()
|