// Type definitions.
-/* Information associated with one thread participating in a barrier. */
+/** Information associated with one thread participating in a barrier. */
struct barrier_thread_info
{
UWord tid; // A DrdThreadId
tl_assert(sizeof(((struct barrier_thread_info*)0)->tid)
>= sizeof(DrdThreadId));
p->oset = VG_(OSetGen_Create)(0, 0, VG_(malloc), VG_(free));
+ vc_init(&p->finished_threads_vc, 0, 0);
}
/** Deallocate the memory allocated by barrier_initialize() and in p->oset.
barrier_thread_destroy(q);
}
VG_(OSetGen_Destroy)(p->oset);
+ vc_cleanup(&p->finished_threads_vc);
}
/** Look up the client-side barrier address barrier in s_barrier[]. If not
thread_combine_vc2(tid, &r->vc[p->post_iteration]);
}
}
+ thread_combine_vc2(tid, &p->finished_threads_vc);
thread_new_segment(tid);
struct barrier_thread_info* q;
const UWord word_tid = tid;
q = VG_(OSetGen_Remove)(p->oset, &word_tid);
+ vc_combine(&p->finished_threads_vc, &q->vc[p->post_iteration]);
barrier_thread_destroy(q);
VG_(OSetGen_FreeNode)(p->oset, q);
}
Word pre_waiters_left; // number of waiters left for a complete barrier.
Word post_waiters_left; // number of waiters left for a complete barrier.
OSet* oset; // Thread-specific barrier information.
+ VectorClock finished_threads_vc;
};
struct rwlock_info