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
c74c5cb2
Commit
c74c5cb2
authored
Sep 29, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Critical section are internally recursive
Remove all this useless stuff of mine.
parent
edbcbee7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
39 deletions
+2
-39
include/vlc_threads.h
include/vlc_threads.h
+0
-3
src/misc/threads.c
src/misc/threads.c
+2
-36
No files found.
include/vlc_threads.h
View file @
c74c5cb2
...
...
@@ -119,9 +119,6 @@ typedef struct
typedef
struct
{
CRITICAL_SECTION
mutex
;
LONG
owner
;
unsigned
recursion
;
bool
recursive
;
}
vlc_mutex_t
;
typedef
HANDLE
vlc_cond_t
;
...
...
src/misc/threads.c
View file @
c74c5cb2
...
...
@@ -247,8 +247,9 @@ int vlc_mutex_init( vlc_mutex_t *p_mutex )
return
i_result
;
#elif defined( WIN32 )
/* This creates a recursive mutex. This is OK as fast mutexes have
* no defined behavior in case of recursive locking. */
InitializeCriticalSection
(
&
p_mutex
->
mutex
);
p_mutex
->
recursive
=
false
;
return
0
;
#endif
...
...
@@ -275,9 +276,6 @@ int vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
#elif defined( WIN32 )
InitializeCriticalSection
(
&
p_mutex
->
mutex
);
p_mutex
->
owner
=
0
;
/* the error value for GetThreadId()! */
p_mutex
->
recursion
=
0
;
p_mutex
->
recursive
=
true
;
return
0
;
#endif
...
...
@@ -317,24 +315,6 @@ void vlc_mutex_lock (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT
(
"locking mutex"
);
#elif defined( WIN32 )
if
(
p_mutex
->
recursive
)
{
DWORD
self
=
GetCurrentThreadId
();
if
((
DWORD
)
InterlockedCompareExchange
(
&
p_mutex
->
owner
,
self
,
self
)
==
self
)
{
/* We already locked this recursive mutex */
p_mutex
->
recursion
++
;
return
;
}
/* We need to lock this recursive mutex */
EnterCriticalSection
(
&
p_mutex
->
mutex
);
self
=
InterlockedExchange
(
&
p_mutex
->
owner
,
self
);
assert
(
self
==
0
);
/* no previous owner */
return
;
}
/* Non-recursive mutex */
EnterCriticalSection
(
&
p_mutex
->
mutex
);
#endif
...
...
@@ -352,18 +332,6 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
VLC_THREAD_ASSERT
(
"unlocking mutex"
);
#elif defined( WIN32 )
if
(
p_mutex
->
recursive
)
{
if
(
p_mutex
->
recursion
!=
0
)
{
p_mutex
->
recursion
--
;
return
;
/* We still own this mutex */
}
/* We release the mutex */
InterlockedExchange
(
&
p_mutex
->
owner
,
0
);
/* fall through */
}
LeaveCriticalSection
(
&
p_mutex
->
mutex
);
#endif
...
...
@@ -504,7 +472,6 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
#elif defined( WIN32 )
DWORD
result
;
assert
(
!
p_mutex
->
recursive
);
do
{
vlc_testcancel
();
...
...
@@ -545,7 +512,6 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
#elif defined( WIN32 )
DWORD
result
;
assert
(
!
p_mutex
->
recursive
);
do
{
vlc_testcancel
();
...
...
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