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
20894e2f
Commit
20894e2f
authored
Feb 25, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert the per-thread mutex list to a standard list.
parent
e8d1e2f7
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
15 deletions
+9
-15
mutex.c
server/mutex.c
+7
-12
thread.c
server/thread.c
+1
-1
thread.h
server/thread.h
+1
-2
No files found.
server/mutex.c
View file @
20894e2f
...
@@ -37,8 +37,7 @@ struct mutex
...
@@ -37,8 +37,7 @@ struct mutex
struct
thread
*
owner
;
/* mutex owner */
struct
thread
*
owner
;
/* mutex owner */
unsigned
int
count
;
/* recursion count */
unsigned
int
count
;
/* recursion count */
int
abandoned
;
/* has it been abandoned? */
int
abandoned
;
/* has it been abandoned? */
struct
mutex
*
next
;
struct
list
entry
;
/* entry in owner thread mutex list */
struct
mutex
*
prev
;
};
};
static
void
mutex_dump
(
struct
object
*
obj
,
int
verbose
);
static
void
mutex_dump
(
struct
object
*
obj
,
int
verbose
);
...
@@ -71,7 +70,6 @@ static struct mutex *create_mutex( const WCHAR *name, size_t len, int owned )
...
@@ -71,7 +70,6 @@ static struct mutex *create_mutex( const WCHAR *name, size_t len, int owned )
mutex
->
count
=
0
;
mutex
->
count
=
0
;
mutex
->
owner
=
NULL
;
mutex
->
owner
=
NULL
;
mutex
->
abandoned
=
0
;
mutex
->
abandoned
=
0
;
mutex
->
next
=
mutex
->
prev
=
NULL
;
if
(
owned
)
mutex_satisfied
(
&
mutex
->
obj
,
current
);
if
(
owned
)
mutex_satisfied
(
&
mutex
->
obj
,
current
);
}
}
}
}
...
@@ -83,19 +81,18 @@ static void do_release( struct mutex *mutex )
...
@@ -83,19 +81,18 @@ static void do_release( struct mutex *mutex )
{
{
assert
(
!
mutex
->
count
);
assert
(
!
mutex
->
count
);
/* remove the mutex from the thread list of owned mutexes */
/* remove the mutex from the thread list of owned mutexes */
if
(
mutex
->
next
)
mutex
->
next
->
prev
=
mutex
->
prev
;
list_remove
(
&
mutex
->
entry
);
if
(
mutex
->
prev
)
mutex
->
prev
->
next
=
mutex
->
next
;
else
mutex
->
owner
->
mutex
=
mutex
->
next
;
mutex
->
owner
=
NULL
;
mutex
->
owner
=
NULL
;
mutex
->
next
=
mutex
->
prev
=
NULL
;
wake_up
(
&
mutex
->
obj
,
0
);
wake_up
(
&
mutex
->
obj
,
0
);
}
}
void
abandon_mutexes
(
struct
thread
*
thread
)
void
abandon_mutexes
(
struct
thread
*
thread
)
{
{
while
(
thread
->
mutex
)
struct
list
*
ptr
;
while
((
ptr
=
list_head
(
&
thread
->
mutex_list
))
!=
NULL
)
{
{
struct
mutex
*
mutex
=
thread
->
mutex
;
struct
mutex
*
mutex
=
LIST_ENTRY
(
ptr
,
struct
mutex
,
entry
)
;
assert
(
mutex
->
owner
==
thread
);
assert
(
mutex
->
owner
==
thread
);
mutex
->
count
=
0
;
mutex
->
count
=
0
;
mutex
->
abandoned
=
1
;
mutex
->
abandoned
=
1
;
...
@@ -129,9 +126,7 @@ static int mutex_satisfied( struct object *obj, struct thread *thread )
...
@@ -129,9 +126,7 @@ static int mutex_satisfied( struct object *obj, struct thread *thread )
{
{
assert
(
!
mutex
->
owner
);
assert
(
!
mutex
->
owner
);
mutex
->
owner
=
thread
;
mutex
->
owner
=
thread
;
mutex
->
prev
=
NULL
;
list_add_head
(
&
thread
->
mutex_list
,
&
mutex
->
entry
);
if
((
mutex
->
next
=
thread
->
mutex
))
mutex
->
next
->
prev
=
mutex
;
thread
->
mutex
=
mutex
;
}
}
if
(
!
mutex
->
abandoned
)
return
0
;
if
(
!
mutex
->
abandoned
)
return
0
;
mutex
->
abandoned
=
0
;
mutex
->
abandoned
=
0
;
...
...
server/thread.c
View file @
20894e2f
...
@@ -115,7 +115,6 @@ inline static void init_thread_structure( struct thread *thread )
...
@@ -115,7 +115,6 @@ inline static void init_thread_structure( struct thread *thread )
thread
->
unix_tid
=
-
1
;
/* not known yet */
thread
->
unix_tid
=
-
1
;
/* not known yet */
thread
->
context
=
NULL
;
thread
->
context
=
NULL
;
thread
->
teb
=
NULL
;
thread
->
teb
=
NULL
;
thread
->
mutex
=
NULL
;
thread
->
debug_ctx
=
NULL
;
thread
->
debug_ctx
=
NULL
;
thread
->
debug_event
=
NULL
;
thread
->
debug_event
=
NULL
;
thread
->
queue
=
NULL
;
thread
->
queue
=
NULL
;
...
@@ -139,6 +138,7 @@ inline static void init_thread_structure( struct thread *thread )
...
@@ -139,6 +138,7 @@ inline static void init_thread_structure( struct thread *thread )
thread
->
creation_time
=
time
(
NULL
);
thread
->
creation_time
=
time
(
NULL
);
thread
->
exit_time
=
0
;
thread
->
exit_time
=
0
;
list_init
(
&
thread
->
mutex_list
);
list_init
(
&
thread
->
system_apc
);
list_init
(
&
thread
->
system_apc
);
list_init
(
&
thread
->
user_apc
);
list_init
(
&
thread
->
user_apc
);
...
...
server/thread.h
View file @
20894e2f
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
struct
process
;
struct
process
;
struct
thread_wait
;
struct
thread_wait
;
struct
thread_apc
;
struct
thread_apc
;
struct
mutex
;
struct
debug_ctx
;
struct
debug_ctx
;
struct
debug_event
;
struct
debug_event
;
struct
msg_queue
;
struct
msg_queue
;
...
@@ -57,7 +56,7 @@ struct thread
...
@@ -57,7 +56,7 @@ struct thread
struct
thread
*
proc_prev
;
struct
thread
*
proc_prev
;
struct
process
*
process
;
struct
process
*
process
;
thread_id_t
id
;
/* thread id */
thread_id_t
id
;
/* thread id */
struct
mutex
*
mutex
;
/* list of currently owned mutexes */
struct
list
mutex_list
;
/* list of currently owned mutexes */
struct
debug_ctx
*
debug_ctx
;
/* debugger context if this thread is a debugger */
struct
debug_ctx
*
debug_ctx
;
/* debugger context if this thread is a debugger */
struct
debug_event
*
debug_event
;
/* debug event being sent to debugger */
struct
debug_event
*
debug_event
;
/* debug event being sent to debugger */
struct
msg_queue
*
queue
;
/* message queue */
struct
msg_queue
*
queue
;
/* message queue */
...
...
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