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
4dc02f7b
Commit
4dc02f7b
authored
Apr 23, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: Simplify mutex
parent
6ed74223
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
14 deletions
+11
-14
include/vlc_threads.h
include/vlc_threads.h
+1
-4
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+4
-4
src/misc/threads.c
src/misc/threads.c
+6
-6
No files found.
include/vlc_threads.h
View file @
4dc02f7b
...
...
@@ -128,10 +128,7 @@ typedef struct
typedef
BOOL
(
WINAPI
*
SIGNALOBJECTANDWAIT
)
(
HANDLE
,
HANDLE
,
DWORD
,
BOOL
);
typedef
struct
{
HANDLE
mutex
;
}
vlc_mutex_t
;
typedef
HANDLE
vlc_mutex_t
;
typedef
struct
{
...
...
include/vlc_threads_funcs.h
View file @
4dc02f7b
...
...
@@ -101,7 +101,7 @@ static inline void __vlc_mutex_lock( const char * psz_file, int i_line,
#elif defined( WIN32 )
VLC_UNUSED
(
psz_file
);
VLC_UNUSED
(
i_line
);
WaitForSingleObject
(
p_mutex
->
mutex
,
INFINITE
);
WaitForSingleObject
(
*
p_
mutex
,
INFINITE
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
acquire_sem
(
p_mutex
->
lock
);
...
...
@@ -136,7 +136,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
#elif defined( WIN32 )
VLC_UNUSED
(
psz_file
);
VLC_UNUSED
(
i_line
);
ReleaseMutex
(
p_mutex
->
mutex
);
ReleaseMutex
(
*
p_
mutex
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
release_sem
(
p_mutex
->
lock
);
...
...
@@ -232,7 +232,7 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
/* Increase our wait count */
p_condvar
->
i_waiting_threads
++
;
SignalObjectAndWait
(
p_mutex
->
mutex
,
p_condvar
->
event
,
INFINITE
,
FALSE
);
SignalObjectAndWait
(
*
p_
mutex
,
p_condvar
->
event
,
INFINITE
,
FALSE
);
p_condvar
->
i_waiting_threads
--
;
/* Reacquire the mutex before returning. */
...
...
@@ -299,7 +299,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
/* Increase our wait count */
p_condvar
->
i_waiting_threads
++
;
result
=
SignalObjectAndWait
(
p_mutex
->
mutex
,
p_condvar
->
event
,
result
=
SignalObjectAndWait
(
*
p_
mutex
,
p_condvar
->
event
,
delay_ms
,
FALSE
);
p_condvar
->
i_waiting_threads
--
;
...
...
src/misc/threads.c
View file @
4dc02f7b
...
...
@@ -229,8 +229,8 @@ int __vlc_mutex_init( vlc_mutex_t *p_mutex )
return
0
;
#elif defined( WIN32 )
p_mutex
->
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
return
(
p_mutex
->
mutex
!=
NULL
?
0
:
1
)
;
*
p_
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
return
(
*
p_mutex
!=
NULL
)
?
0
:
ENOMEM
;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
/* check the arguments and whether it's already been initialized */
...
...
@@ -280,8 +280,8 @@ int __vlc_mutex_init_recursive( vlc_mutex_t *p_mutex )
{
#if defined( WIN32 )
/* Create mutex returns a recursive mutex */
p_mutex
->
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
return
(
p_mutex
->
mutex
!=
NULL
?
0
:
1
)
;
*
p_
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
return
(
*
p_mutex
!=
NULL
)
?
0
:
ENOMEM
;
#elif defined( LIBVLC_USE_PTHREAD )
pthread_mutexattr_t
attr
;
int
i_result
;
...
...
@@ -318,7 +318,7 @@ void __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mute
#elif defined( WIN32 )
VLC_UNUSED
(
psz_file
);
VLC_UNUSED
(
i_line
);
CloseHandle
(
p_mutex
->
mutex
);
CloseHandle
(
*
p_
mutex
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if
(
p_mutex
->
init
==
9999
)
...
...
@@ -417,7 +417,7 @@ int __vlc_threadvar_create( vlc_threadvar_t *p_tls )
#if defined( HAVE_KERNEL_SCHEDULER_H )
# error Unimplemented!
#elif defined( UNDER_CE )
|| defined( WIN32 )
#elif defined( UNDER_CE )
#elif defined( WIN32 )
*
p_tls
=
TlsAlloc
();
i_ret
=
(
*
p_tls
==
INVALID_HANDLE_VALUE
)
?
EAGAIN
:
0
;
...
...
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