Skip to content
Snippets Groups Projects
Commit a00aa4ab authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Condvar: New "wait_record" type

Both mutex and condvar have a wait queue - which is a linked list of
wait records, each containing a thread pointer to wake and a "next" pointer.
Unfortunately, mutex and condvar each used a different type: mutex used
linked_item<thread*>, while condvar used struct ccondvar_waiter.

We want both mutex and condvar to use the same wait_record structure,
so we can add in a later patch the "wait morphing" feature (moving a
waiter from the condvar's queue to a mutex's queue).

This patch defines a single type, "struct wait_record", suitable for
both uses. In particular, it is a struct, not a template, so that pointers
to it can be used in C code (see <osv/condvar.h>).

wait_record is a structure containing a "waiter" and a "next" pointer.
The "waiter" is just a thread pointer, which together with a few methods
becomes a simple synchronization mechanism which we always used but now
for the first time we encapsulate it in a type.
parent a0263334
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment