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
8762b941
Commit
8762b941
authored
May 17, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: avoid broadcast in vlc_cond_signal()
parent
52894f2f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
4 deletions
+28
-4
src/win32/thread.c
src/win32/thread.c
+28
-4
No files found.
src/win32/thread.c
View file @
8762b941
...
...
@@ -225,10 +225,29 @@ void vlc_cond_destroy(vlc_cond_t *wait)
CloseHandle
(
wait
->
semaphore
);
}
void
vlc_cond_signal
(
vlc_cond_t
*
p_condvar
)
static
LONG
InterlockedDecrementNonZero
(
LONG
volatile
*
dst
)
{
/* This is suboptimal but works. */
vlc_cond_broadcast
(
p_condvar
);
LONG
cmp
,
val
=
1
;
do
{
cmp
=
val
;
val
=
InterlockedCompareExchange
(
dst
,
val
-
1
,
val
);
if
(
val
==
0
)
return
0
;
}
while
(
cmp
!=
val
);
return
val
;
}
void
vlc_cond_signal
(
vlc_cond_t
*
wait
)
{
if
(
!
wait
->
clock
)
return
;
if
(
InterlockedDecrementNonZero
(
&
wait
->
waiters
)
>
0
)
ReleaseSemaphore
(
wait
->
semaphore
,
1
,
NULL
);
}
void
vlc_cond_broadcast
(
vlc_cond_t
*
wait
)
...
...
@@ -243,6 +262,8 @@ void vlc_cond_broadcast(vlc_cond_t *wait)
void
vlc_cond_wait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
)
{
DWORD
result
;
vlc_testcancel
();
if
(
!
wait
->
clock
)
...
...
@@ -253,8 +274,11 @@ void vlc_cond_wait(vlc_cond_t *wait, vlc_mutex_t *lock)
InterlockedIncrement
(
&
wait
->
waiters
);
vlc_mutex_unlock
(
lock
);
vlc_WaitForSingleObject
(
wait
->
semaphore
,
INFINITE
);
result
=
vlc_WaitForSingleObject
(
wait
->
semaphore
,
INFINITE
);
vlc_mutex_lock
(
lock
);
if
(
result
==
WAIT_IO_COMPLETION
)
vlc_testcancel
();
}
int
vlc_cond_timedwait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
,
mtime_t
deadline
)
...
...
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