Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
98965e0b
Commit
98965e0b
authored
8 years ago
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement libuv timer. test__socket.py passes.
parent
772e8be8
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
0 deletions
+29
-0
src/gevent/_ffi/watcher.py
src/gevent/_ffi/watcher.py
+2
-0
src/gevent/libuv/_corecffi_cdef.c
src/gevent/libuv/_corecffi_cdef.c
+1
-0
src/gevent/libuv/watcher.py
src/gevent/libuv/watcher.py
+26
-0
No files found.
src/gevent/_ffi/watcher.py
View file @
98965e0b
...
...
@@ -311,6 +311,8 @@ class TimerMixin(object):
def
__init__
(
self
,
loop
,
after
=
0.0
,
repeat
=
0.0
,
ref
=
True
,
priority
=
None
):
if
repeat
<
0.0
:
raise
ValueError
(
"repeat must be positive or zero: %r"
%
repeat
)
self
.
_after
=
after
self
.
_repeat
=
repeat
super
(
TimerMixin
,
self
).
__init__
(
loop
,
ref
=
ref
,
priority
=
priority
,
args
=
(
after
,
repeat
))
def
start
(
self
,
callback
,
*
args
,
**
kw
):
...
...
This diff is collapsed.
Click to expand it.
src/gevent/libuv/_corecffi_cdef.c
View file @
98965e0b
...
...
@@ -166,6 +166,7 @@ int uv_loop_alive(const uv_loop_t *loop);
int
uv_loop_close
(
uv_loop_t
*
loop
);
int
uv_run
(
uv_loop_t
*
,
uv_run_mode
mode
);
int
uv_backend_fd
(
const
uv_loop_t
*
loop
);
void
uv_update_time
(
const
uv_loop_t
*
loop
);
uint64_t
uv_now
(
const
uv_loop_t
*
loop
);
void
uv_stop
(
uv_loop_t
*
);
void
uv_walk
(
uv_loop_t
*
loop
,
uv_walk_cb
walk_cb
,
void
*
arg
);
...
...
This diff is collapsed.
Click to expand it.
src/gevent/libuv/watcher.py
View file @
98965e0b
...
...
@@ -113,3 +113,29 @@ class async(_base.AsyncMixin, watcher):
@
property
def
pending
(
self
):
return
None
class
timer
(
_base
.
TimerMixin
,
watcher
):
def
_update_now
(
self
):
self
.
loop
.
update
()
_again
=
False
def
_watcher_ffi_init
(
self
,
args
):
self
.
_watcher_init
(
self
.
loop
.
_ptr
,
self
.
_watcher
)
self
.
_after
,
self
.
_repeat
=
args
def
_watcher_ffi_start
(
self
):
if
self
.
_again
:
libuv
.
uv_timer_again
(
self
.
_watcher
)
else
:
self
.
_watcher_start
(
self
.
_watcher
,
self
.
_watcher_callback
,
int
(
self
.
_after
*
1000
),
int
(
self
.
_repeat
*
1000
))
def
again
(
self
,
callback
,
*
args
,
**
kw
):
self
.
_again
=
True
try
:
self
.
start
(
callback
,
*
args
,
**
kw
)
finally
:
del
self
.
_again
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment