DragonFly kernel List (threaded) for 2007-08
DragonFly BSD
DragonFly kernel List (threaded) for 2007-08
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

sleep/wakeup sequence using tsleep_interlock


From: Aggelos Economopoulos <aoiko@xxxxxxxxxxxxxx>
Date: Sun, 19 Aug 2007 00:51:55 +0300

According to the comment preceding tsleep_interlock() in kern_synch.c:

/*
 * This is a dandy function that allows us to interlock tsleep/wakeup
 * operations with unspecified upper level locks, such as lockmgr locks,
 * simply by holding a critical section.  The sequence is:
 *
 *	(enter critical section)
 *	(acquire upper level lock)
 *	tsleep_interlock(blah)
 *	(release upper level lock)
 *	tsleep(blah, ...)
 *	(exit critical section)

It is not obvious to me why the first two operations can't be reversed (i.e. 
first acquire lock, then enter critical section). Can they?

TIA,
Aggelos



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]