Skip to content

Commit e63a163

Browse files
author
brett hartshorn
committed
fixed enum parser, updated libev wrapper and example
1 parent 7e9999f commit e63a163

4 files changed

Lines changed: 207 additions & 239 deletions

File tree

examples/libev-helloworld.py

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,21 @@
66
"touch /tmp/hi"
77
run this script
88
run a few more times "touch /tmp/hi"
9-
109
'''
1110

1211
import os, sys, time, ctypes
1312
import libev as ev
14-
1513
print('libev version: %s.%s' %(ev.version_major(), ev.version_minor()))
1614

17-
main = ev.default_loop( 2 ) # ev.EVBACKEND_POLL = 2
18-
print(main)
19-
20-
def ev_init(watcher, callback):
21-
watcher.active = 0
22-
watcher.pending = 0
23-
cb = ev.ev_watcher._fields_[-1][-1]( callback )
24-
watcher.cb = cb
25-
26-
def ev_stat_init( watcher, callback, path, interval=0.0 ):
27-
ev_init( watcher, callback )
28-
watcher.path = path
29-
watcher.interval = interval
15+
assert ev.EVBACKEND_POLL == 2
16+
main = ev.default_loop( ev.EVBACKEND_POLL )
3017

3118
watcher = ev.ev_stat()
3219
def mycallback( loop, watcher, revents ):
3320
print(loop, watcher, revents)
3421

35-
ev_init( watcher, mycallback )
36-
ev_stat_init( watcher, mycallback, '/tmp/hi' )
22+
ev.init( watcher, mycallback )
23+
ev.stat_init( watcher, mycallback, '/tmp/hi' )
3724
ptr = ctypes.pointer( watcher )
3825
ev.stat_start( main, ptr )
3926

0 commit comments

Comments
 (0)