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
dbab5e26
Commit
dbab5e26
authored
Aug 04, 1999
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the mutex from the thread list when destroying it.
parent
6c6da674
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
+16
-5
mutex.c
server/mutex.c
+16
-5
No files found.
server/mutex.c
View file @
dbab5e26
...
@@ -28,6 +28,7 @@ struct mutex
...
@@ -28,6 +28,7 @@ struct mutex
static
void
mutex_dump
(
struct
object
*
obj
,
int
verbose
);
static
void
mutex_dump
(
struct
object
*
obj
,
int
verbose
);
static
int
mutex_signaled
(
struct
object
*
obj
,
struct
thread
*
thread
);
static
int
mutex_signaled
(
struct
object
*
obj
,
struct
thread
*
thread
);
static
int
mutex_satisfied
(
struct
object
*
obj
,
struct
thread
*
thread
);
static
int
mutex_satisfied
(
struct
object
*
obj
,
struct
thread
*
thread
);
static
void
mutex_destroy
(
struct
object
*
obj
);
static
const
struct
object_ops
mutex_ops
=
static
const
struct
object_ops
mutex_ops
=
{
{
...
@@ -41,7 +42,7 @@ static const struct object_ops mutex_ops =
...
@@ -41,7 +42,7 @@ static const struct object_ops mutex_ops =
no_write_fd
,
no_write_fd
,
no_flush
,
no_flush
,
no_get_file_info
,
no_get_file_info
,
no
_destroy
mutex
_destroy
};
};
...
@@ -65,13 +66,13 @@ static struct mutex *create_mutex( const char *name, size_t len, int owned )
...
@@ -65,13 +66,13 @@ static struct mutex *create_mutex( const char *name, size_t len, int owned )
}
}
/* release a mutex once the recursion count is 0 */
/* release a mutex once the recursion count is 0 */
static
void
do_release
(
struct
mutex
*
mutex
,
struct
thread
*
thread
)
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
;
if
(
mutex
->
next
)
mutex
->
next
->
prev
=
mutex
->
prev
;
if
(
mutex
->
prev
)
mutex
->
prev
->
next
=
mutex
->
next
;
if
(
mutex
->
prev
)
mutex
->
prev
->
next
=
mutex
->
next
;
else
thread
->
mutex
=
mutex
->
next
;
else
mutex
->
owner
->
mutex
=
mutex
->
next
;
mutex
->
owner
=
NULL
;
mutex
->
owner
=
NULL
;
mutex
->
next
=
mutex
->
prev
=
NULL
;
mutex
->
next
=
mutex
->
prev
=
NULL
;
wake_up
(
&
mutex
->
obj
,
0
);
wake_up
(
&
mutex
->
obj
,
0
);
...
@@ -85,7 +86,7 @@ void abandon_mutexes( struct thread *thread )
...
@@ -85,7 +86,7 @@ void abandon_mutexes( struct thread *thread )
assert
(
mutex
->
owner
==
thread
);
assert
(
mutex
->
owner
==
thread
);
mutex
->
count
=
0
;
mutex
->
count
=
0
;
mutex
->
abandoned
=
1
;
mutex
->
abandoned
=
1
;
do_release
(
mutex
,
thread
);
do_release
(
mutex
);
}
}
}
}
...
@@ -123,6 +124,16 @@ static int mutex_satisfied( struct object *obj, struct thread *thread )
...
@@ -123,6 +124,16 @@ static int mutex_satisfied( struct object *obj, struct thread *thread )
return
1
;
return
1
;
}
}
static
void
mutex_destroy
(
struct
object
*
obj
)
{
struct
mutex
*
mutex
=
(
struct
mutex
*
)
obj
;
assert
(
obj
->
ops
==
&
mutex_ops
);
if
(
!
mutex
->
count
)
return
;
mutex
->
count
=
0
;
do_release
(
mutex
);
}
/* create a mutex */
/* create a mutex */
DECL_HANDLER
(
create_mutex
)
DECL_HANDLER
(
create_mutex
)
{
{
...
@@ -153,7 +164,7 @@ DECL_HANDLER(release_mutex)
...
@@ -153,7 +164,7 @@ DECL_HANDLER(release_mutex)
MUTEX_MODIFY_STATE
,
&
mutex_ops
)))
MUTEX_MODIFY_STATE
,
&
mutex_ops
)))
{
{
if
(
!
mutex
->
count
||
(
mutex
->
owner
!=
current
))
set_error
(
ERROR_NOT_OWNER
);
if
(
!
mutex
->
count
||
(
mutex
->
owner
!=
current
))
set_error
(
ERROR_NOT_OWNER
);
else
if
(
!--
mutex
->
count
)
do_release
(
mutex
,
current
);
else
if
(
!--
mutex
->
count
)
do_release
(
mutex
);
release_object
(
mutex
);
release_object
(
mutex
);
}
}
}
}
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