Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
4707b4f4
Commit
4707b4f4
authored
Aug 18, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: emulate static condition variables
This is really poor implementation, but it is not really used.
parent
6e54f3fd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
include/vlc_threads.h
include/vlc_threads.h
+1
-0
src/win32/thread.c
src/win32/thread.c
+22
-7
No files found.
include/vlc_threads.h
View file @
4707b4f4
...
@@ -144,6 +144,7 @@ typedef struct
...
@@ -144,6 +144,7 @@ typedef struct
HANDLE
handle
;
HANDLE
handle
;
unsigned
clock
;
unsigned
clock
;
}
vlc_cond_t
;
}
vlc_cond_t
;
#define VLC_STATIC_COND { 0, 0, 0 }
typedef
HANDLE
vlc_sem_t
;
typedef
HANDLE
vlc_sem_t
;
...
...
src/win32/thread.c
View file @
4707b4f4
...
@@ -232,8 +232,8 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
...
@@ -232,8 +232,8 @@ void vlc_mutex_unlock (vlc_mutex_t *p_mutex)
/*** Condition variables ***/
/*** Condition variables ***/
enum
enum
{
{
CLOCK_REALTIME
=
0
,
/* must be zero for VLC_STATIC_COND */
CLOCK_MONOTONIC
,
CLOCK_MONOTONIC
,
CLOCK_REALTIME
,
};
};
static
void
vlc_cond_init_common
(
vlc_cond_t
*
p_condvar
,
unsigned
clock
)
static
void
vlc_cond_init_common
(
vlc_cond_t
*
p_condvar
,
unsigned
clock
)
...
@@ -262,16 +262,19 @@ void vlc_cond_destroy (vlc_cond_t *p_condvar)
...
@@ -262,16 +262,19 @@ void vlc_cond_destroy (vlc_cond_t *p_condvar)
void
vlc_cond_signal
(
vlc_cond_t
*
p_condvar
)
void
vlc_cond_signal
(
vlc_cond_t
*
p_condvar
)
{
{
/* NOTE: This will cause a broadcast, that is wrong.
if
(
!
p_condvar
->
handle
)
* This will also wake up the next waiting thread if no threads are yet
return
;
* waiting, which is also wrong. However both of these issues are allowed
* by the provision for spurious wakeups. Better have too many wakeups
/* This is suboptimal but works. */
* than too few (= deadlocks). */
vlc_cond_broadcast
(
p_condvar
);
SetEvent
(
p_condvar
->
handle
);
}
}
void
vlc_cond_broadcast
(
vlc_cond_t
*
p_condvar
)
void
vlc_cond_broadcast
(
vlc_cond_t
*
p_condvar
)
{
{
if
(
!
p_condvar
->
handle
)
return
;
/* Wake all threads up (as the event HANDLE has manual reset) */
SetEvent
(
p_condvar
->
handle
);
SetEvent
(
p_condvar
->
handle
);
}
}
...
@@ -279,6 +282,12 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
...
@@ -279,6 +282,12 @@ void vlc_cond_wait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex)
{
{
DWORD
result
;
DWORD
result
;
if
(
!
p_condvar
->
handle
)
{
/* FIXME FIXME FIXME */
msleep
(
50000
);
return
;
}
do
do
{
{
vlc_testcancel
();
vlc_testcancel
();
...
@@ -296,6 +305,12 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
...
@@ -296,6 +305,12 @@ int vlc_cond_timedwait (vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex,
{
{
DWORD
result
;
DWORD
result
;
if
(
!
p_condvar
->
handle
)
{
/* FIXME FIXME FIXME */
msleep
(
50000
);
return
0
;
}
do
do
{
{
vlc_testcancel
();
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