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
f044d6ff
Commit
f044d6ff
authored
Aug 09, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32 condition variable: remove write-only counter
parent
cf1a4702
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
31 deletions
+12
-31
include/vlc_threads.h
include/vlc_threads.h
+6
-22
src/misc/threads.c
src/misc/threads.c
+6
-9
No files found.
include/vlc_threads.h
View file @
f044d6ff
...
...
@@ -117,17 +117,9 @@ typedef pthread_key_t vlc_threadvar_t;
#elif defined( WIN32 ) || defined( UNDER_CE )
typedef
HANDLE
vlc_thread_t
;
typedef
BOOL
(
WINAPI
*
SIGNALOBJECTANDWAIT
)
(
HANDLE
,
HANDLE
,
DWORD
,
BOOL
);
typedef
HANDLE
vlc_mutex_t
;
typedef
struct
{
volatile
int
i_waiting_threads
;
HANDLE
event
;
}
vlc_cond_t
;
typedef
HANDLE
vlc_cond_t
;
typedef
DWORD
vlc_threadvar_t
;
#elif defined( SYS_BEOS )
...
...
@@ -283,7 +275,7 @@ static inline void __vlc_cond_signal( const char * psz_file, int i_line,
/* PulseEvent() only works if none of the waiting threads is suspended.
* This is particularily problematic under a debug session.
* as documented in http://support.microsoft.com/kb/q173260/ */
PulseEvent
(
p_condvar
->
event
);
PulseEvent
(
*
p_condvar
);
#elif defined( SYS_BEOS )
while
(
p_condvar
->
thread
!=
-
1
)
...
...
@@ -324,10 +316,8 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
VLC_THREAD_ASSERT
(
"waiting on condition"
);
#elif defined( UNDER_CE )
p_condvar
->
i_waiting_threads
++
;
LeaveCriticalSection
(
&
p_mutex
->
csection
);
WaitForSingleObject
(
p_condvar
->
event
,
INFINITE
);
p_condvar
->
i_waiting_threads
--
;
WaitForSingleObject
(
*
p_condvar
,
INFINITE
);
/* Reacquire the mutex before returning. */
vlc_mutex_lock
(
p_mutex
);
...
...
@@ -336,9 +326,7 @@ static inline void __vlc_cond_wait( const char * psz_file, int i_line,
(
void
)
psz_file
;
(
void
)
i_line
;
/* Increase our wait count */
p_condvar
->
i_waiting_threads
++
;
SignalObjectAndWait
(
*
p_mutex
,
p_condvar
->
event
,
INFINITE
,
FALSE
);
p_condvar
->
i_waiting_threads
--
;
SignalObjectAndWait
(
*
p_mutex
,
*
p_condvar
,
INFINITE
,
FALSE
);
/* Reacquire the mutex before returning. */
vlc_mutex_lock
(
p_mutex
);
...
...
@@ -386,10 +374,8 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
if
(
delay_ms
<
0
)
delay_ms
=
0
;
p_condvar
->
i_waiting_threads
++
;
LeaveCriticalSection
(
&
p_mutex
->
csection
);
result
=
WaitForSingleObject
(
p_condvar
->
event
,
delay_ms
);
p_condvar
->
i_waiting_threads
--
;
result
=
WaitForSingleObject
(
*
p_condvar
,
delay_ms
);
/* Reacquire the mutex before returning. */
vlc_mutex_lock
(
p_mutex
);
...
...
@@ -406,10 +392,8 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
delay_ms
=
0
;
/* Increase our wait count */
p_condvar
->
i_waiting_threads
++
;
result
=
SignalObjectAndWait
(
*
p_mutex
,
p_condvar
->
event
,
result
=
SignalObjectAndWait
(
*
p_mutex
,
*
p_condvar
,
delay_ms
,
FALSE
);
p_condvar
->
i_waiting_threads
--
;
/* Reacquire the mutex before returning. */
vlc_mutex_lock
(
p_mutex
);
...
...
src/misc/threads.c
View file @
f044d6ff
...
...
@@ -360,15 +360,12 @@ int __vlc_cond_init( vlc_cond_t *p_condvar )
return
ret
;
#elif defined( UNDER_CE ) || defined( WIN32 )
/* Initialize counter */
p_condvar
->
i_waiting_threads
=
0
;
/* Create an auto-reset event. */
p_condvar
->
event
=
CreateEvent
(
NULL
,
/* no security */
FALSE
,
/* auto-reset event */
FALSE
,
/* start non-signaled */
NULL
);
/* unnamed */
return
!
p_condvar
->
event
;
*
p_condvar
=
CreateEvent
(
NULL
,
/* no security */
FALSE
,
/* auto-reset event */
FALSE
,
/* start non-signaled */
NULL
);
/* unnamed */
return
*
p_condvar
?
0
:
ENOMEM
;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
if
(
!
p_condvar
)
...
...
@@ -400,7 +397,7 @@ void __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condva
#elif defined( UNDER_CE ) || defined( WIN32 )
VLC_UNUSED
(
psz_file
);
VLC_UNUSED
(
i_line
);
CloseHandle
(
p_condvar
->
event
);
CloseHandle
(
*
p_condvar
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
p_condvar
->
init
=
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