> Well,
>
> > funct()
> > {
> > size_t ticks;
> > wait_queue_head_t wqhead;
> > init_waitqueue_head(&wqhead);
> >
> > ticks = 1 * HZ; /* For 1 second */
> > while((ticks = interruptible_sleep_on_timeout(&wqhead, ticks)) > 0)
> > ;
> > }
> Well, this works.
Good.
>
> The question is: should I call init_waitqueue_head() every time I call
> interruptible_sleep_on_timeout() or is it enough to call it once in
> init_module() ?
Just once is fine.
>
> Another one: should I call wake_up_interruptible() to
> release pending request?
Nope. If you got control back due to the timeout, it's done. You
have been awakened. If somebody else wants to wake up your sleeping
giant (like an interrupt), it calls wake_up_interruptible() with
the pointer to the wait-queue it wants to affect.
> --
> Alex Ivchenko, Ph.D.
> United Electronic Industries, Inc.
> "The High-Performance Alternative (tm)"
> --
> 10 Dexter Avenue
> Watertown, Massachusetts 02472
> Tel: (617) 924-1155 x 222 Fax: (617) 924-1441
> http://www.ueidaq.com
>
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
I was going to compile a list of innovations that could be
attributed to Microsoft. Once I realized that Ctrl-Alt-Del
was handled in the BIOS, I found that there aren't any.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/