/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/python/cpython2/Lib/test/ |
D | lock_tests.py | 432 sem = self.semtype(1) 433 sem.acquire() 434 sem.release() 435 sem = self.semtype(2) 436 sem.acquire() 437 sem.acquire() 438 sem.release() 439 sem.release() 442 sem = self.semtype() 443 sem.acquire() [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/libdrm/amdgpu/ |
D | amdgpu_cs.c | 43 static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem); 44 static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem); 127 amdgpu_semaphore_handle sem; in amdgpu_cs_ctx_free() local 128 LIST_FOR_EACH_ENTRY(sem, &context->sem_list[i][j][k], list) { in amdgpu_cs_ctx_free() 129 list_del(&sem->list); in amdgpu_cs_ctx_free() 130 amdgpu_cs_reset_sem(sem); in amdgpu_cs_ctx_free() 131 amdgpu_cs_unreference_sem(sem); in amdgpu_cs_ctx_free() 182 amdgpu_semaphore_handle sem, tmp; in amdgpu_cs_submit_one() local 280 LIST_FOR_EACH_ENTRY(sem, sem_list, list) in amdgpu_cs_submit_one() 289 LIST_FOR_EACH_ENTRY_SAFE(sem, tmp, sem_list, list) { in amdgpu_cs_submit_one() [all …]
|
/external/python/cpython3/Lib/test/test_asyncio/ |
D | test_locks.py | 710 sem = asyncio.Semaphore(loop=loop) 711 self.assertIs(sem._loop, loop) 713 sem = asyncio.Semaphore(loop=self.loop) 714 self.assertIs(sem._loop, self.loop) 718 sem = asyncio.Semaphore() 719 self.assertIs(sem._loop, self.loop) 722 sem = asyncio.Semaphore(0, loop=self.loop) 723 self.assertTrue(sem.locked()) 726 sem = asyncio.Semaphore(loop=self.loop) 727 self.assertTrue(repr(sem).endswith('[unlocked,value:1]>')) [all …]
|
/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/python/cpython3/Lib/test/ |
D | lock_tests.py | 595 sem = self.semtype(1) 596 sem.acquire() 597 sem.release() 598 sem = self.semtype(2) 599 sem.acquire() 600 sem.acquire() 601 sem.release() 602 sem.release() 605 sem = self.semtype() 606 sem.acquire() [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/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/ |
D | 8-1.c | 81 sem_t *sem, *sem_1; in child_fn() local 86 sem = sem_open(semname, 0); in child_fn() 87 if (sem == SEM_FAILED) { in child_fn() 103 if (sem_wait(sem) == -1) { in child_fn() 119 sem_t *sem, *sem_1; in main() local 128 sem = sem_open(semname, O_CREAT | O_EXCL, 0777, 1); in main() 129 if (sem == SEM_FAILED) { in main() 151 if (sem_wait(sem) == -1) { in main() 213 sem_post(sem); in main() 218 sem_post(sem); 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/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/valgrind/drd/ |
D | drd_pthread_intercepts.c | 1332 int sem_init_intercept(sem_t *sem, int pshared, unsigned int value) in sem_init_intercept() argument 1338 sem, pshared, value, 0, 0); in sem_init_intercept() 1339 CALL_FN_W_WWW(ret, fn, sem, pshared, value); in sem_init_intercept() 1341 sem, 0, 0, 0, 0); in sem_init_intercept() 1346 (sem_t *sem, int pshared, unsigned int value), (sem, pshared, value)); 1350 int sema_init_intercept(sema_t *sem, unsigned int value, int type, void *arg) in sema_init_intercept() argument 1356 sem, type == USYNC_PROCESS ? 1 : 0, in sema_init_intercept() 1358 CALL_FN_W_WWWW(ret, fn, sem, value, type, arg); in sema_init_intercept() 1360 sem, 0, 0, 0, 0); in sema_init_intercept() 1365 (sema_t *sem, unsigned int value, int type, void *arg), [all …]
|
/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 | 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 145 sem = alloc_sem(MAX_SEMS); in main() 146 if (sem == NULL) { in main() 160 child(pages, sem); in main() 164 if (sem_wait(&sem[SEM_CHILD_SETUP]) == -1) in main() 178 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main() 184 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/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/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()
|