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
aa347686
Commit
aa347686
authored
Mar 01, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert the object wait queue to a standard list.
parent
dc457f0f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
29 deletions
+17
-29
fd.c
server/fd.c
+3
-3
object.c
server/object.c
+2
-4
object.h
server/object.h
+4
-6
queue.c
server/queue.c
+1
-1
thread.c
server/thread.c
+7
-15
No files found.
server/fd.c
View file @
aa347686
...
...
@@ -1324,7 +1324,7 @@ int default_fd_add_queue( struct object *obj, struct wait_queue_entry *entry )
struct
fd
*
fd
=
get_obj_fd
(
obj
);
if
(
!
fd
)
return
0
;
if
(
!
obj
->
head
)
/* first on the queue */
if
(
list_empty
(
&
obj
->
wait_queue
)
)
/* first on the queue */
set_fd_events
(
fd
,
fd
->
fd_ops
->
get_poll_events
(
fd
)
);
add_queue
(
obj
,
entry
);
release_object
(
fd
);
...
...
@@ -1338,7 +1338,7 @@ void default_fd_remove_queue( struct object *obj, struct wait_queue_entry *entry
grab_object
(
obj
);
remove_queue
(
obj
,
entry
);
if
(
!
obj
->
head
)
/* last on the queue is gone */
if
(
list_empty
(
&
obj
->
wait_queue
)
)
/* last on the queue is gone */
set_fd_events
(
fd
,
0
);
release_object
(
obj
);
release_object
(
fd
);
...
...
@@ -1357,7 +1357,7 @@ int default_fd_signaled( struct object *obj, struct thread *thread )
if
(
ret
)
set_fd_events
(
fd
,
0
);
/* stop waiting on select() if we are signaled */
else
if
(
obj
->
head
)
else
if
(
!
list_empty
(
&
obj
->
wait_queue
)
)
set_fd_events
(
fd
,
events
);
/* restart waiting on poll() if we are no longer signaled */
release_object
(
fd
);
...
...
server/object.c
View file @
aa347686
...
...
@@ -137,9 +137,8 @@ void *alloc_object( const struct object_ops *ops )
{
obj
->
refcount
=
1
;
obj
->
ops
=
ops
;
obj
->
head
=
NULL
;
obj
->
tail
=
NULL
;
obj
->
name
=
NULL
;
list_init
(
&
obj
->
wait_queue
);
#ifdef DEBUG_OBJECTS
list_add_head
(
&
object_list
,
&
obj
->
obj_list
);
#endif
...
...
@@ -205,8 +204,7 @@ void release_object( void *ptr )
if
(
!--
obj
->
refcount
)
{
/* if the refcount is 0, nobody can be in the wait queue */
assert
(
!
obj
->
head
);
assert
(
!
obj
->
tail
);
assert
(
list_empty
(
&
obj
->
wait_queue
));
obj
->
ops
->
destroy
(
obj
);
if
(
obj
->
name
)
free_name
(
obj
);
#ifdef DEBUG_OBJECTS
...
...
server/object.h
View file @
aa347686
...
...
@@ -69,8 +69,7 @@ struct object
{
unsigned
int
refcount
;
/* reference count */
const
struct
object_ops
*
ops
;
struct
wait_queue_entry
*
head
;
struct
wait_queue_entry
*
tail
;
struct
list
wait_queue
;
struct
object_name
*
name
;
#ifdef DEBUG_OBJECTS
struct
list
obj_list
;
...
...
@@ -79,10 +78,9 @@ struct object
struct
wait_queue_entry
{
struct
wait_queue_entry
*
next
;
struct
wait_queue_entry
*
prev
;
struct
object
*
obj
;
struct
thread
*
thread
;
struct
list
entry
;
struct
object
*
obj
;
struct
thread
*
thread
;
};
extern
void
*
mem_alloc
(
size_t
size
);
/* malloc wrapper */
...
...
server/queue.c
View file @
aa347686
...
...
@@ -663,7 +663,7 @@ static int is_queue_hung( struct msg_queue *queue )
if
(
now
.
tv_sec
-
queue
->
last_get_msg
.
tv_sec
<=
5
)
return
0
;
/* less than 5 seconds since last get message -> not hung */
for
(
entry
=
queue
->
obj
.
head
;
entry
;
entry
=
entry
->
next
)
LIST_FOR_EACH_ENTRY
(
entry
,
&
queue
->
obj
.
wait_queue
,
struct
wait_queue_entry
,
entry
)
{
if
(
entry
->
thread
->
queue
==
queue
)
return
0
;
/* thread is waiting on queue -> not hung */
...
...
server/thread.c
View file @
aa347686
...
...
@@ -342,22 +342,15 @@ static int resume_thread( struct thread *thread )
int
add_queue
(
struct
object
*
obj
,
struct
wait_queue_entry
*
entry
)
{
grab_object
(
obj
);
entry
->
obj
=
obj
;
entry
->
prev
=
obj
->
tail
;
entry
->
next
=
NULL
;
if
(
obj
->
tail
)
obj
->
tail
->
next
=
entry
;
else
obj
->
head
=
entry
;
obj
->
tail
=
entry
;
entry
->
obj
=
obj
;
list_add_tail
(
&
obj
->
wait_queue
,
&
entry
->
entry
);
return
1
;
}
/* remove a thread from an object wait queue */
void
remove_queue
(
struct
object
*
obj
,
struct
wait_queue_entry
*
entry
)
{
if
(
entry
->
next
)
entry
->
next
->
prev
=
entry
->
prev
;
else
obj
->
tail
=
entry
->
prev
;
if
(
entry
->
prev
)
entry
->
prev
->
next
=
entry
->
next
;
else
obj
->
head
=
entry
->
next
;
list_remove
(
&
entry
->
entry
);
release_object
(
obj
);
}
...
...
@@ -569,13 +562,12 @@ done:
/* attempt to wake threads sleeping on the object wait queue */
void
wake_up
(
struct
object
*
obj
,
int
max
)
{
struct
wait_queue_entry
*
entry
=
obj
->
head
;
struct
list
*
ptr
,
*
next
;
while
(
entry
)
LIST_FOR_EACH_SAFE
(
ptr
,
next
,
&
obj
->
wait_queue
)
{
struct
thread
*
thread
=
entry
->
thread
;
entry
=
entry
->
next
;
if
(
wake_thread
(
thread
))
struct
wait_queue_entry
*
entry
=
LIST_ENTRY
(
ptr
,
struct
wait_queue_entry
,
entry
);
if
(
wake_thread
(
entry
->
thread
))
{
if
(
max
&&
!--
max
)
break
;
}
...
...
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