Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
debc9d47
Commit
debc9d47
authored
Sep 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rwlock: cancellation safety
parent
fba184a0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
src/misc/rwlock.h
src/misc/rwlock.h
+6
-0
src/posix/thread.c
src/posix/thread.c
+2
-0
No files found.
src/misc/rwlock.h
View file @
debc9d47
...
...
@@ -60,7 +60,9 @@ void vlc_rwlock_rdlock (vlc_rwlock_t *lock)
while
(
lock
->
state
<
0
)
{
assert
(
lock
->
state
==
WRITER_BIT
);
mutex_cleanup_push
(
&
lock
->
mutex
);
vlc_cond_wait
(
&
lock
->
wait
,
&
lock
->
mutex
);
vlc_cleanup_pop
();
}
if
(
unlikely
(
lock
->
state
>=
READER_MASK
))
abort
();
/* An overflow is certainly a recursion bug. */
...
...
@@ -73,7 +75,11 @@ void vlc_rwlock_wrlock (vlc_rwlock_t *lock)
vlc_mutex_lock
(
&
lock
->
mutex
);
/* Wait until nobody owns the lock in any way. */
while
(
lock
->
state
!=
0
)
{
mutex_cleanup_push
(
&
lock
->
mutex
);
vlc_cond_wait
(
&
lock
->
wait
,
&
lock
->
mutex
);
vlc_cleanup_pop
();
}
lock
->
state
=
WRITER_BIT
;
vlc_mutex_unlock
(
&
lock
->
mutex
);
}
...
...
src/posix/thread.c
View file @
debc9d47
...
...
@@ -558,6 +558,7 @@ void vlc_rwlock_destroy (vlc_rwlock_t *lock)
/**
* Acquires a read/write lock for reading. Recursion is allowed.
* @note This function may be a point of cancellation.
*/
void
vlc_rwlock_rdlock
(
vlc_rwlock_t
*
lock
)
{
...
...
@@ -567,6 +568,7 @@ void vlc_rwlock_rdlock (vlc_rwlock_t *lock)
/**
* Acquires a read/write lock for writing. Recursion is not allowed.
* @note This function may be a point of cancellation.
*/
void
vlc_rwlock_wrlock
(
vlc_rwlock_t
*
lock
)
{
...
...
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