Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / gist:840611
Created February 23, 2011 16:07
struct spinlock s;
int doomsday = 0;
doomsday_thr() {
for (;;) {
spin_lock(&s);
while (doomsday == 0) {
tsleep_interlock(BADNESS, 0);
spin_unlock(&s);
tsleep(BADNESS, PINTERLOCK, "waiting-for-end", 0);
anonymous
anonymous / gist:840601
Created February 23, 2011 16:03
struct spinlock s;
int doomsday = 0;
doomsday_thr() {
for (;;) {
spin_lock(&s);
while (doomsday == 0) {
spin_unlock(&s);
/* XXX */
tsleep(BADNESS, 0, "waiting-for-end", 0);