Home
last modified time | relevance | path

Searched refs:sem (Results 1 – 25 of 233) sorted by relevance

12345678910

/external/libvpx/libvpx/vp8/common/
Dthreading.h93 #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/deqp/framework/delibs/dethread/unix/
DdeNamedSemaphoreUnix.c39 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 …]
DdeSemaphoreUnix.c36 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/
Dlock_tests.py456 sem = self.semtype(1)
457 sem.acquire()
458 sem.release()
459 sem = self.semtype(2)
460 sem.acquire()
461 sem.acquire()
462 sem.release()
463 sem.release()
466 sem = self.semtype()
467 sem.acquire()
[all …]
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_unlink/
D2-2.c89 sem_t *sem; in common() local
92 sem = sem_open(SEM_NAME, 0); in common()
94 if (sem == SEM_FAILED) { in common()
101 ret = sem_wait(sem); in common()
117 ret = sem_post(sem); in common()
123 return sem; in common()
132 sem_t *sem; in main() local
138 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main()
140 if ((sem == SEM_FAILED) && (errno == EEXIST)) { in main()
142 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 0); in main()
[all …]
D7-1.c103 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()
D9-1.c110 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()
D3-1.c131 sem_t *sem; in main() local
137 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0744, 1); in main()
139 if ((sem == SEM_FAILED) && (errno == EEXIST)) { in main()
141 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0744, 1); in main()
144 if (sem == SEM_FAILED) { in main()
157 sem = sem_open(SEM_NAME, 0); in main()
159 if (sem == SEM_FAILED) { in main()
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_close/
D3-2.c92 sem_t *sem; in main() local
98 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 2); in main()
100 if (sem == SEM_FAILED && errno == EEXIST) { in main()
102 sem = sem_open(SEM_NAME, O_CREAT | O_EXCL, 0777, 2); in main()
105 if (sem == SEM_FAILED) { in main()
111 ret = sem_wait(sem); in main()
119 ret = sem_close(sem); in main()
126 sem = sem_open(SEM_NAME, O_CREAT, 0777, 3); in main()
128 if (sem == SEM_FAILED) { in main()
133 ret = sem_getvalue(sem, &value); in main()
[all …]
/external/python/cpython3/Lib/test/
Dlock_tests.py615 sem = self.semtype(1)
616 sem.acquire()
617 sem.release()
618 sem = self.semtype(2)
619 sem.acquire()
620 sem.acquire()
621 sem.release()
622 sem.release()
625 sem = self.semtype()
626 sem.acquire()
[all …]
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_post/
D8-1.c81 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/
Dnamedsem.c30 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/python/cpython3/Lib/test/test_asyncio/
Dtest_locks.py832 sem = asyncio.Semaphore(loop=loop)
833 self.assertIs(sem._loop, loop)
835 sem = asyncio.Semaphore(loop=self.loop)
836 self.assertIs(sem._loop, self.loop)
840 sem = asyncio.Semaphore()
841 self.assertIs(sem._loop, self.loop)
844 sem = asyncio.Semaphore(0, loop=self.loop)
845 self.assertTrue(sem.locked())
848 sem = asyncio.Semaphore(loop=self.loop)
849 self.assertTrue(repr(sem).endswith('[unlocked, value:1]>'))
[all …]
/external/libdrm/amdgpu/
Damdgpu_cs.c39 static int amdgpu_cs_unreference_sem(amdgpu_semaphore_handle sem);
40 static int amdgpu_cs_reset_sem(amdgpu_semaphore_handle sem);
130 amdgpu_semaphore_handle sem; in amdgpu_cs_ctx_free() local
131 LIST_FOR_EACH_ENTRY(sem, &context->sem_list[i][j][k], list) { in amdgpu_cs_ctx_free()
132 list_del(&sem->list); in amdgpu_cs_ctx_free()
133 amdgpu_cs_reset_sem(sem); in amdgpu_cs_ctx_free()
134 amdgpu_cs_unreference_sem(sem); in amdgpu_cs_ctx_free()
185 amdgpu_semaphore_handle sem, tmp; in amdgpu_cs_submit_one() local
281 LIST_FOR_EACH_ENTRY(sem, sem_list, list) in amdgpu_cs_submit_one()
290 LIST_FOR_EACH_ENTRY_SAFE(sem, tmp, sem_list, list) { in amdgpu_cs_submit_one()
[all …]
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/pthread_cancel/
D2-1.c25 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()
/external/ltp/testcases/kernel/syscalls/move_pages/
Dmove_pages03.c85 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()
178 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main()
183 free_sem(sem, MAX_SEMS); in main()
Dmove_pages11.c86 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()
Dmove_pages05.c86 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()
191 if (sem_post(&sem[SEM_PARENT_TEST]) == -1) in main()
196 free_sem(sem, MAX_SEMS); in main()
/external/compiler-rt/test/tsan/Darwin/
Dgcd-io.mm8 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/
Dithread.c129 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/libmpeg2/common/
Dithread.c137 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/libavc/common/
Dithread.c140 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/compiler-rt/test/sanitizer_common/TestCases/Linux/
Dsem_init_glibc.cc21 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/ltp/testcases/open_posix_testsuite/conformance/interfaces/fork/
D1-1.c57 sem_t *sem; in main() local
77 sem = sem_open(SEM_NAME, O_CREAT, O_RDWR, 0); in main()
78 if (sem == SEM_FAILED) in main()
88 ret = sem_post(sem); in main()
94 ret = sem_close(sem); in main()
104 ret = sem_timedwait(sem, &tsfin); in main()
114 ret = sem_close(sem); in main()
/external/ltp/testcases/open_posix_testsuite/conformance/interfaces/sem_getvalue/
D2-2.c99 sem_t sem; in main() local
106 ret = sem_init(&sem, 0, 0); in main()
113 ret = pthread_create(&th, NULL, threaded, &sem); in main()
123 ret = sem_getvalue(&sem, &val); in main()
136 ret = sem_post(&sem); in main()
150 ret = sem_destroy(&sem); in main()

12345678910