| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Mon, Mar 11, 2002 at 05:06:55PM -0500, Jim Magee wrote:On Monday, March 11, 2002, at 04:45 PM, Stefan Arentz wrote:On Mon, Mar 11, 2002 at 09:16:16AM -0500, Jim Magee wrote:One "problem" the kqueues implementation presents: multiple threads
sharing a kqueue.
Are you refering to kernel threads or user threads?
I'm referring to multiple threads (pthreads) in an application waiting
on a single kqueue. The same problem arises, however, if each thread
has its own kqueue, but the same event source is added to multiple of
them. In either case, more than thread will be awakened if the source
fires.
The documentation does not say anything about multiple threads sharing a
kqueue. I think it was never intended to be used like that. Don't you
typically create multiple queues (multiple kqueues can exist in a single
process) with different event sources and then use worker threads to
serialize the incoming events?
When multiple threads listen on the same queue then an out of order problem
can occur. Say that two threads are listening to events from the same
socket descriptor. It is possible that thread A fires and receives the
EV_READ event that is also marked EOF (socket closed) *before* thread B
is able to process the previous EV_READ.
BTW, I'm reading http://stuff.sateh.com/Mach/kernel_principles.pdf now. Is
this document still relevant? It's almost 10 years old now :-/
| References: | |
| >Re: kqueue/kevent project (From: Stefan Arentz <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.