Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0a6af139
Commit
0a6af139
authored
Sep 07, 2004
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure to run through the poll loop once before processing newly
added timers (reported by Mike McCormack).
parent
25b23a09
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
17 deletions
+32
-17
fd.c
server/fd.c
+32
-17
No files found.
server/fd.c
View file @
0a6af139
...
...
@@ -242,17 +242,6 @@ void add_timeout( struct timeval *when, int timeout )
}
}
/* handle the next expired timeout */
inline
static
void
handle_timeout
(
void
)
{
struct
timeout_user
*
user
=
timeout_head
;
timeout_head
=
user
->
next
;
if
(
user
->
next
)
user
->
next
->
prev
=
user
->
prev
;
else
timeout_tail
=
user
->
prev
;
user
->
callback
(
user
->
private
);
free
(
user
);
}
/****************************************************************/
/* poll support */
...
...
@@ -327,20 +316,46 @@ void main_loop(void)
long
diff
=
-
1
;
if
(
timeout_head
)
{
struct
timeout_user
*
first
=
timeout_head
;
struct
timeval
now
;
gettimeofday
(
&
now
,
NULL
);
while
(
timeout_head
)
/* first remove all expired timers from the list */
while
(
timeout_head
&&
!
time_before
(
&
now
,
&
timeout_head
->
when
))
timeout_head
=
timeout_head
->
next
;
if
(
timeout_head
)
{
if
(
!
time_before
(
&
now
,
&
timeout_head
->
when
))
handle_timeout
();
else
if
(
timeout_head
->
prev
)
{
diff
=
(
timeout_head
->
when
.
tv_sec
-
now
.
tv_sec
)
*
1000
+
(
timeout_head
->
when
.
tv_usec
-
now
.
tv_usec
)
/
1000
;
break
;
timeout_head
->
prev
->
next
=
NULL
;
timeout_head
->
prev
=
NULL
;
}
else
first
=
NULL
;
/* no timer removed */
}
else
timeout_tail
=
NULL
;
/* all timers removed */
/* now call the callback for all the removed timers */
while
(
first
)
{
struct
timeout_user
*
next
=
first
->
next
;
first
->
callback
(
first
->
private
);
free
(
first
);
first
=
next
;
}
if
(
!
active_users
)
break
;
/* last user removed by a timeout */
if
(
timeout_head
)
{
diff
=
(
timeout_head
->
when
.
tv_sec
-
now
.
tv_sec
)
*
1000
+
(
timeout_head
->
when
.
tv_usec
-
now
.
tv_usec
)
/
1000
;
if
(
diff
<
0
)
diff
=
0
;
}
}
ret
=
poll
(
pollfd
,
nb_users
,
diff
);
if
(
ret
>
0
)
{
...
...
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