lkml.org 
[lkml]   [2006]   [Nov]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [take25 1/6] kevent: Description.
On Wed, Nov 22, 2006 at 03:46:42PM -0800, Ulrich Drepper (drepper@redhat.com) wrote:
> Evgeniy Polyakov wrote:
> >+ int kevent_wait(int ctl_fd, unsigned int num, __u64 timeout);
> >+
> >+ctl_fd - file descriptor referring to the kevent queue
> >+num - number of processed kevents
> >+timeout - this timeout specifies number of nanoseconds to wait until
> >there is + free space in kevent queue
> >+
> >+Return value:
> >+ number of events copied into ring buffer or negative error value.
>
> This is not quite sufficient. What we also need is a parameter which
> specifies which ring buffer the code assumes is currently active. This
> is just like the EWOULDBLOCK error in the futex. I.e., the kernel
> doesn't move the thread on the wait list if the index has changed.
> Otherwise asynchronous ring buffer filling is impossible. Assume this
>
> thread kernel
>
> get current ring buffer idx
>
> front and tail pointer the same
>
> add new entry to ring buffer
>
> bump front pointer
>
> call kevent_wait()
>
>
> With the interface above this leads to a deadlock. The kernel delivered
> the event and is done with it.

Kernel does not put there a new entry, it is only done inside
kevent_wait(). Entries are put into queue (in any context), where they can be obtained
from only kevent_wait() or kevent_get_events().

--
Evgeniy Polyakov
-
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/

\
 
 \ /
  Last update: 2006-11-23 12:57    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site