is there a good way to do this atomically: if (!thing) sleep_until(thing); ? erm.. thing may become asserted by an interrupt hrm. * gbWrk thinks spin_lock_and_cli() That's the only way I know zait: well, there's a test, followed by a sleep but what if the wakeup happens inbetween the test and the sleep gb: check and add to wait queue have to be in the lock f: ok * gbWrk fiddles gb: that is why you should near never use sleep_on, it is usually racy yeah is there a better way to block a syscall like this? you can always use a bigger hammer i'm doing a write() which will block if a buffer is full and i want to do: if (full) block..; and an interrupt will deassert full gb: just steal the logic from tcp.c or datagram.c @) it is ok, but you should be careful that full has a big enough threshold to avoid too many unnecessary wakeups (otherwise you get silly window syndrome in kernel) f: which function? (i'm not familar with the net subsystem) gb: add_wait_queue(...); while (doing work) { blah blah; set_task_state(TASK_INTERRUPTIBLE); if (full) schedule(); ... } remove_wait_queue(...); and if (signals_pending(...)) break; after the schedule too Awesome <-- sshack has quit (Wojteken dies) And no cli, heh zaitcev: cli is for wusses why, thank you * bcrl giggles real men use toggle switches it makes no difference, the lock is just hidden in the add_wait_queue and lots of blinky lights better use a slightly bigger lock and do it in one go f: add_wait_queue could be made lockless you know (there are ways) i doubt that the ways are practical bcrl: while(doing work) ? -- Credentials -- bcrl: Benjamin LaHaise f: Andi Kleen gbWrk: Gerald Britton dan`b: Daniel Barlow zaitcev: Pete Zaitcev sshack: Steven Shack