classification
Title: kqueue timers don't work properly
Type: behavior Stage:
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: hasan
Priority: normal Keywords:

Created on 2009-12-11 12:08 by hasan, last changed 2009-12-11 21:53 by hasan. This issue is now closed.

Messages (3)
msg96247 - (view) Author: Hasan (hasan) Date: 2009-12-11 12:08
kqueue timers are not working at all on Mac OSX 10.6.1 (probably not 
working on other BSDs as well but haven't tested it).

Here's a simply repro:

from select import *
kq = kqueue()
e = kevent(10000, flags=KQ_EV_ENABLE|KQ_EV_ONESHOT, 
filter=KQ_FILTER_TIMER)
e
<select.kevent ident=10000 filter=-7 flags=0x14 fflags=0x0 data=0x0 
udata=0x0>
new_e = f.control([e], 1, 0)

This should block 10s before it returns control with new_e having a timer 
event returned. However, it isn't the case.
control returns immediately returning a busted event:
[<select.kevent ident=10000 filter=-7 flags=0x4000 fflags=0x0 data=0x2 
udata=0x0>]

Am I missing something?
msg96250 - (view) Author: Hasan (hasan) Date: 2009-12-11 12:35
Typo in the repro.

The statement:
new_e = f.control
should be:
new_e = kq.control
msg96274 - (view) Author: Hasan (hasan) Date: 2009-12-11 21:53
Closing it. My mistake. I was passing incorrect arguments. KQ_EV_ONESHOT 
requires KQ_EV_ADD as well, and timer data goes into data.
History
Date User Action Args
2009-12-11 21:53:52hasansetstatus: open -> closed

messages: + msg96274
2009-12-11 12:35:28hasansetmessages: + msg96250
2009-12-11 12:08:50hasancreate