On Wed, May 11, 2005 at 11:04:24PM -0400, Harry Orenstein wrote:
> Apparently, the function 'interruptible_sleep_on' is deprecated in favor of 
> 'wait_event_interruptible', which requires an additional parameter (a 
> condition on which to wait).

If you have old code something like


                while(1) {
                        if(new_wombats(inode))
                                break;
                        /* POINT A */
                        interruptible_sleep_on(&wombat_factory);
                }

this has problems if a wombat is produced at point A, you may sleep forever
unless you are using the old lock_kernel locking. With the new locking the
wait_event macros unroll the testing into the sleep so the result is safely
ordered and it becomes


                wait_event_interruptible(wombat_factory, new_wombats(inode));

(One thing confusing about this is that it is a macro so new_wombats() isn't
called once and passed to the function, its called each time the kernel wants
to decide if we woke for the right reason).

This assumes new_wombats() returns 0 for "no" and 1 for "yes, finished".

In effect you write a function that tests if we should wake up and that is
the macro argument. You can also place simple tests in the call itself - eg

        wait_event_interruptible(queue->wait, queue->tail != queue->head);

Alan



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
_______________________________________________
ivtv-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ivtv-devel

Reply via email to