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
66bc867f
Commit
66bc867f
authored
Jun 06, 2011
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update libev to latest CVS
parent
9f916ac0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
40 additions
and
41 deletions
+40
-41
libev/ev.c
libev/ev.c
+4
-12
libev/ev_epoll.c
libev/ev_epoll.c
+7
-5
libev/ev_kqueue.c
libev/ev_kqueue.c
+4
-4
libev/ev_poll.c
libev/ev_poll.c
+4
-4
libev/ev_port.c
libev/ev_port.c
+9
-3
libev/ev_select.c
libev/ev_select.c
+9
-10
libev/ev_vars.h
libev/ev_vars.h
+1
-1
libev/ev_wrap.h
libev/ev_wrap.h
+2
-2
No files found.
libev/ev.c
View file @
66bc867f
...
...
@@ -872,14 +872,6 @@ ev_sleep (ev_tstamp delay)
}
}
inline_speed
int
ev_timeout_to_ms
(
ev_tstamp
timeout
)
{
int
ms
=
timeout
*
1000
.
+
.
999999
;
return
expect_true
(
ms
)
?
ms
:
timeout
<
1e-6
?
0
:
1
;
}
/*****************************************************************************/
#define MALLOC_ROUND 4096
/* prefer to allocate in chunks of this size, must be 2**n and >> 4 longs */
...
...
@@ -2515,14 +2507,14 @@ ev_run (EV_P_ int flags)
if
(
timercnt
)
{
ev_tstamp
to
=
ANHE_at
(
timers
[
HEAP0
])
-
mn_now
+
backend_
fudg
e
;
ev_tstamp
to
=
ANHE_at
(
timers
[
HEAP0
])
-
mn_now
+
backend_
mintim
e
;
if
(
waittime
>
to
)
waittime
=
to
;
}
#if EV_PERIODIC_ENABLE
if
(
periodiccnt
)
{
ev_tstamp
to
=
ANHE_at
(
periodics
[
HEAP0
])
-
ev_rt_now
+
backend_
fudg
e
;
ev_tstamp
to
=
ANHE_at
(
periodics
[
HEAP0
])
-
ev_rt_now
+
backend_
mintim
e
;
if
(
waittime
>
to
)
waittime
=
to
;
}
#endif
...
...
@@ -2536,8 +2528,8 @@ ev_run (EV_P_ int flags)
{
sleeptime
=
io_blocktime
-
(
mn_now
-
prev_mn_now
);
if
(
sleeptime
>
waittime
-
backend_
fudg
e
)
sleeptime
=
waittime
-
backend_
fudg
e
;
if
(
sleeptime
>
waittime
-
backend_
mintim
e
)
sleeptime
=
waittime
-
backend_
mintim
e
;
if
(
expect_true
(
sleeptime
>
0
.))
{
...
...
libev/ev_epoll.c
View file @
66bc867f
...
...
@@ -144,11 +144,13 @@ epoll_poll (EV_P_ ev_tstamp timeout)
int
i
;
int
eventcnt
;
if
(
expect_false
(
epoll_epermcnt
))
timeout
=
0
.;
/* epoll wait times cannot be larger than (LONG_MAX - 999UL) / HZ msecs, which is below */
/* the default libev max wait time, however. */
EV_RELEASE_CB
;
eventcnt
=
epoll_wait
(
backend_fd
,
epoll_events
,
epoll_eventmax
,
epoll_epermcnt
?
0
:
ev_timeout_to_ms
(
timeout
));
eventcnt
=
epoll_wait
(
backend_fd
,
epoll_events
,
epoll_eventmax
,
timeout
*
1e3
);
EV_ACQUIRE_CB
;
if
(
expect_false
(
eventcnt
<
0
))
...
...
@@ -234,9 +236,9 @@ epoll_init (EV_P_ int flags)
fcntl
(
backend_fd
,
F_SETFD
,
FD_CLOEXEC
);
backend_
fudge
=
0
.;
/* kernel sources seem to indicate this to be zero
*/
backend_modify
=
epoll_modify
;
backend_poll
=
epoll_poll
;
backend_
mintime
=
1
.
/
1024
.;
/* epoll does sometimes return early, this is just to avoid the worst
*/
backend_modify
=
epoll_modify
;
backend_poll
=
epoll_poll
;
epoll_eventmax
=
64
;
/* initial number of events receivable per poll */
epoll_events
=
(
struct
epoll_event
*
)
ev_malloc
(
sizeof
(
struct
epoll_event
)
*
epoll_eventmax
);
...
...
libev/ev_kqueue.c
View file @
66bc867f
/*
* libev kqueue backend
*
* Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007,2008,2009,2010
,2011
Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
...
...
@@ -161,9 +161,9 @@ kqueue_init (EV_P_ int flags)
fcntl
(
backend_fd
,
F_SETFD
,
FD_CLOEXEC
);
/* not sure if necessary, hopefully doesn't hurt */
backend_
fudge
=
0
.;
backend_modify
=
kqueue_modify
;
backend_poll
=
kqueue_poll
;
backend_
mintime
=
1e-9
;
/* apparently, they did the right thing in freebsd */
backend_modify
=
kqueue_modify
;
backend_poll
=
kqueue_poll
;
kqueue_eventmax
=
64
;
/* initial number of events receivable per poll */
kqueue_events
=
(
struct
kevent
*
)
ev_malloc
(
sizeof
(
struct
kevent
)
*
kqueue_eventmax
);
...
...
libev/ev_poll.c
View file @
66bc867f
...
...
@@ -92,7 +92,7 @@ poll_poll (EV_P_ ev_tstamp timeout)
int
res
;
EV_RELEASE_CB
;
res
=
poll
(
polls
,
pollcnt
,
ev_timeout_to_ms
(
timeout
)
);
res
=
poll
(
polls
,
pollcnt
,
timeout
*
1e3
);
EV_ACQUIRE_CB
;
if
(
expect_false
(
res
<
0
))
...
...
@@ -129,9 +129,9 @@ poll_poll (EV_P_ ev_tstamp timeout)
int
inline_size
poll_init
(
EV_P_
int
flags
)
{
backend_
fudge
=
0
.;
/* posix says this is zero */
backend_modify
=
poll_modify
;
backend_poll
=
poll_poll
;
backend_
mintime
=
1e-3
;
backend_modify
=
poll_modify
;
backend_poll
=
poll_poll
;
pollidxs
=
0
;
pollidxmax
=
0
;
polls
=
0
;
pollmax
=
0
;
pollcnt
=
0
;
...
...
libev/ev_port.c
View file @
66bc867f
...
...
@@ -147,9 +147,15 @@ port_init (EV_P_ int flags)
fcntl
(
backend_fd
,
F_SETFD
,
FD_CLOEXEC
);
/* not sure if necessary, hopefully doesn't hurt */
backend_fudge
=
1e-3
;
/* needed to compensate for port_getn returning early */
backend_modify
=
port_modify
;
backend_poll
=
port_poll
;
/* if my reading of the opensolaris kernel sources are correct, then
* opensolaris does something very stupid: it checks if the time has already
* elapsed and doesn't round up if that is the case,m otherwise it DOES round
* up. Since we can't know what the case is, we need to guess by using a
* "large enough" timeout. Normally, 1e-9 would be correct.
*/
backend_mintime
=
1e-3
;
/* needed to compensate for port_getn returning early */
backend_modify
=
port_modify
;
backend_poll
=
port_poll
;
port_eventmax
=
64
;
/* initial number of events receivable per poll */
port_events
=
(
port_event_t
*
)
ev_malloc
(
sizeof
(
port_event_t
)
*
port_eventmax
);
...
...
libev/ev_select.c
View file @
66bc867f
/*
* libev select fd activity backend
*
* Copyright (c) 2007,2008,2009,2010 Marc Alexander Lehmann <libev@schmorp.de>
* Copyright (c) 2007,2008,2009,2010
,2011
Marc Alexander Lehmann <libev@schmorp.de>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modifica-
...
...
@@ -196,7 +196,11 @@ select_poll (EV_P_ ev_tstamp timeout)
if
(
errno
==
EINVAL
)
{
if
(
timeout
)
ev_sleep
(
timeout
>=
1e-3
?
timeout
:
1e-3
);
{
unsigned
long
ms
=
timeout
*
1e3
;
Sleep
(
ms
?
ms
:
1
);
}
return
;
}
#endif
...
...
@@ -270,13 +274,9 @@ select_poll (EV_P_ ev_tstamp timeout)
int
inline_size
select_init
(
EV_P_
int
flags
)
{
#ifdef _WIN32
backend_fudge
=
1e-6
;
#else
backend_fudge
=
0
.;
/* posix says this is zero */
#endif
backend_modify
=
select_modify
;
backend_poll
=
select_poll
;
backend_mintime
=
1e-6
;
backend_modify
=
select_modify
;
backend_poll
=
select_poll
;
#if EV_SELECT_USE_FD_SET
vec_ri
=
ev_malloc
(
sizeof
(
fd_set
));
FD_ZERO
((
fd_set
*
)
vec_ri
);
...
...
@@ -312,4 +312,3 @@ select_destroy (EV_P)
#endif
}
libev/ev_vars.h
View file @
66bc867f
...
...
@@ -51,7 +51,7 @@ VARx(int, activecnt) /* total number of active events ("refcount") */
VARx
(
EV_ATOMIC_T
,
loop_done
)
/* signal by ev_break */
VARx
(
int
,
backend_fd
)
VARx
(
ev_tstamp
,
backend_
fudg
e
)
/* assumed typical timer resolution */
VARx
(
ev_tstamp
,
backend_
mintim
e
)
/* assumed typical timer resolution */
VAR
(
backend_modify
,
void
(
*
backend_modify
)(
EV_P_
int
fd
,
int
oev
,
int
nev
))
VAR
(
backend_poll
,
void
(
*
backend_poll
)(
EV_P_
ev_tstamp
timeout
))
...
...
libev/ev_wrap.h
View file @
66bc867f
...
...
@@ -10,7 +10,7 @@
#define activecnt ((loop)->activecnt)
#define loop_done ((loop)->loop_done)
#define backend_fd ((loop)->backend_fd)
#define backend_
fudge ((loop)->backend_fudg
e)
#define backend_
mintime ((loop)->backend_mintim
e)
#define backend_modify ((loop)->backend_modify)
#define backend_poll ((loop)->backend_poll)
#define anfds ((loop)->anfds)
...
...
@@ -107,7 +107,7 @@
#undef activecnt
#undef loop_done
#undef backend_fd
#undef backend_
fudg
e
#undef backend_
mintim
e
#undef backend_modify
#undef backend_poll
#undef anfds
...
...
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