More comments on the ticket lock code

This commit is contained in:
Nils O. Selåsdal
2014-06-25 17:03:14 +02:00
parent 06be01a708
commit 0a6ce86779
2 changed files with 10 additions and 1 deletions
+7
View File
@@ -1,6 +1,13 @@
#include <assert.h>
#include "ucore/ticket_lock.h"
//pthread implementation of http://en.wikipedia.org/wiki/Ticket_lock
//The underlying phtread mutex is not held while the lock is acquired.
//This will allow other threads to enqueue itself.
//
//The condition variable is needed to wake up threads waiting to acquire
//the lock instead of letting the system block on the pthread mutex while waiting.
int uc_ticket_lock_init(struct UCTicketLock *lock)
{
return uc_ticket_lock_init_ex(lock, NULL, NULL);