Lines Matching refs:semaphore
85 /** Enable or disable tracing of semaphore actions. */
93 * client semaphore at client addres 'semaphore'.
97 const Addr semaphore)
99 tl_assert(semaphore != 0);
100 tl_assert(p->a1 == semaphore);
127 "Destruction of semaphore that is being waited"
138 * client semaphore. Allocate a new structure if such a structure did not
143 drd_semaphore_get_or_allocate(const Addr semaphore)
147 tl_assert(offsetof(DrdClientobj, semaphore) == 0);
148 p = &(DRD_(clientobj_get)(semaphore, ClientSemaphore)->semaphore);
151 tl_assert(offsetof(DrdClientobj, semaphore) == 0);
152 p = &(DRD_(clientobj_add)(semaphore, ClientSemaphore)->semaphore);
153 drd_semaphore_initialize(p, semaphore);
160 * client semaphore, or null if no such structure was found.
162 static struct semaphore_info* semaphore_get(const Addr semaphore)
164 tl_assert(offsetof(DrdClientobj, semaphore) == 0);
165 return &(DRD_(clientobj_get)(semaphore, ClientSemaphore)->semaphore);
169 struct semaphore_info* DRD_(semaphore_init)(const Addr semaphore,
178 DRD_(thread_get_running_tid)(), semaphore, value);
180 p = semaphore_get(semaphore);
184 SemaphoreErrInfo SEI = { DRD_(thread_get_running_tid)(), semaphore };
188 "Semaphore reinitialization",
208 p = drd_semaphore_get_or_allocate(semaphore);
218 void DRD_(semaphore_destroy)(const Addr semaphore)
222 p = semaphore_get(semaphore);
226 DRD_(thread_get_running_tid)(), semaphore,
233 .addr = semaphore,
238 "Not a semaphore",
243 DRD_(clientobj_remove)(semaphore, ClientSemaphore);
247 struct semaphore_info* DRD_(semaphore_open)(const Addr semaphore,
258 semaphore, name, oflag, mode, value);
261 if (! semaphore)
264 p = semaphore_get(semaphore);
268 SemaphoreErrInfo SEI = { DRD_(thread_get_running_tid)(), semaphore };
272 "Semaphore reinitialization",
282 p = drd_semaphore_get_or_allocate(semaphore);
291 void DRD_(semaphore_close)(const Addr semaphore)
295 p = semaphore_get(semaphore);
299 DRD_(thread_get_running_tid)(), semaphore,
306 .addr = semaphore,
311 "Not a semaphore",
316 DRD_(clientobj_remove)(semaphore, ClientSemaphore);
320 void DRD_(semaphore_pre_wait)(const Addr semaphore)
324 tl_assert(semaphore < semaphore + 1);
325 p = drd_semaphore_get_or_allocate(semaphore);
331 SemaphoreErrInfo sei = { DRD_(thread_get_running_tid)(), semaphore };
335 "Invalid semaphore",
344 void DRD_(semaphore_post_wait)(const DrdThreadId tid, const Addr semaphore,
351 p = semaphore_get(semaphore);
354 DRD_(thread_get_running_tid)(), semaphore,
364 * Note: if another thread destroyed and reinitialized a semaphore while
372 SemaphoreErrInfo sei = { DRD_(thread_get_running_tid)(), semaphore };
376 "Invalid semaphore",
403 void DRD_(semaphore_pre_post)(const DrdThreadId tid, const Addr semaphore)
408 p = drd_semaphore_get_or_allocate(semaphore);
414 semaphore, p->value - 1, p->value);
426 void DRD_(semaphore_post_post)(const DrdThreadId tid, const Addr semaphore,
433 * the semaphore to its original value here. In order to do that without
435 * each semaphore call. Such extra locking would have to be added in