VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__PRE_SEM_POST,
sem, sizeof(*sem), 0, 0, 0);
CALL_FN_W_W(ret, fn, sem);
- assert(ret == 0);
- if (ret == 0)
- {
- VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
- sem, sizeof(*sem), 0, 0, 0);
- }
+ VALGRIND_DO_CLIENT_REQUEST(res, -1, VG_USERREQ__POST_SEM_POST,
+ sem, sizeof(*sem), ret == 0, 0, 0);
return ret;
}
return False;
if (trace_address)
+ {
drd_trace_address = VG_(strtoll16)(trace_address, 0);
+#if 0
+ VG_(message)(Vg_DebugMsg, "Tracing address %s <> 0x%x\n",
+ trace_address, drd_trace_address);
+#endif
+ }
if (trace_barrier)
barrier_set_trace(trace_barrier);
if (trace_cond)
if (p->value == 1)
{
p->last_sem_post_tid = tid;
+ thread_new_segment(tid);
+ vc_copy(&p->vc, thread_get_vc(tid));
}
}
void semaphore_post_post(const DrdThreadId tid, const Addr semaphore,
const SizeT size, const Bool waited)
{
- if (waited)
- {
- struct semaphore_info* p;
-
- p = semaphore_get_or_allocate(semaphore, size);
- thread_new_segment(tid);
- vc_copy(&p->vc, thread_get_vc(tid));
- }
+ /* Note: it is hard to implement the sem_post() wrapper correctly if */
+ /* sem_post() can return an error code. The reason is that this would */
+ /* require to detect whether sem_post() will fail before sem_post is */
+ /* called -- p->vc may only be modified if the sem_post() call will */
+ /* succeed. */
+ tl_assert(waited);
}
void semaphore_thread_delete(const DrdThreadId threadid)