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
d1bc9375
Commit
d1bc9375
authored
May 18, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: factor common code in vlc_cond_(timed)wait()
parent
a90029df
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
23 deletions
+13
-23
src/win32/thread.c
src/win32/thread.c
+13
-23
No files found.
src/win32/thread.c
View file @
d1bc9375
...
@@ -259,7 +259,8 @@ void vlc_cond_broadcast(vlc_cond_t *wait)
...
@@ -259,7 +259,8 @@ void vlc_cond_broadcast(vlc_cond_t *wait)
ReleaseSemaphore
(
wait
->
semaphore
,
waiters
,
NULL
);
ReleaseSemaphore
(
wait
->
semaphore
,
waiters
,
NULL
);
}
}
void
vlc_cond_wait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
)
static
DWORD
vlc_cond_wait_delay
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
,
DWORD
delay
)
{
{
DWORD
result
;
DWORD
result
;
...
@@ -268,26 +269,29 @@ void vlc_cond_wait(vlc_cond_t *wait, vlc_mutex_t *lock)
...
@@ -268,26 +269,29 @@ void vlc_cond_wait(vlc_cond_t *wait, vlc_mutex_t *lock)
if
(
wait
->
semaphore
==
NULL
)
if
(
wait
->
semaphore
==
NULL
)
{
/* FIXME FIXME FIXME */
{
/* FIXME FIXME FIXME */
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
lock
);
result
=
SleepEx
(
50
,
TRUE
);
result
=
SleepEx
(
(
delay
>
50u
)
?
50u
:
delay
,
TRUE
);
}
}
else
else
{
{
InterlockedIncrement
(
&
wait
->
waiters
);
InterlockedIncrement
(
&
wait
->
waiters
);
vlc_mutex_unlock
(
lock
);
vlc_mutex_unlock
(
lock
);
result
=
vlc_WaitForSingleObject
(
wait
->
semaphore
,
INFINITE
);
result
=
vlc_WaitForSingleObject
(
wait
->
semaphore
,
delay
);
}
}
vlc_mutex_lock
(
lock
);
vlc_mutex_lock
(
lock
);
if
(
result
==
WAIT_IO_COMPLETION
)
if
(
result
==
WAIT_IO_COMPLETION
)
vlc_testcancel
();
vlc_testcancel
();
return
result
;
}
void
vlc_cond_wait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
)
{
vlc_cond_wait_delay
(
wait
,
lock
,
INFINITE
);
}
}
int
vlc_cond_timedwait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
,
mtime_t
deadline
)
int
vlc_cond_timedwait
(
vlc_cond_t
*
wait
,
vlc_mutex_t
*
lock
,
mtime_t
deadline
)
{
{
mtime_t
total
;
mtime_t
total
;
DWORD
result
;
vlc_testcancel
();
switch
(
wait
->
clock
)
switch
(
wait
->
clock
)
{
{
...
@@ -307,23 +311,9 @@ int vlc_cond_timedwait(vlc_cond_t *wait, vlc_mutex_t *lock, mtime_t deadline)
...
@@ -307,23 +311,9 @@ int vlc_cond_timedwait(vlc_cond_t *wait, vlc_mutex_t *lock, mtime_t deadline)
DWORD
delay
=
(
total
>
0x7fffffff
)
?
0x7fffffff
:
total
;
DWORD
delay
=
(
total
>
0x7fffffff
)
?
0x7fffffff
:
total
;
if
(
wait
->
semaphore
==
NULL
)
if
(
vlc_cond_wait_delay
(
wait
,
lock
,
delay
)
==
WAIT_TIMEOUT
)
{
/* FIXME FIXME FIXME */
return
ETIMEDOUT
;
vlc_mutex_unlock
(
lock
);
return
0
;
result
=
SleepEx
((
delay
>
50
)
?
50
:
delay
,
TRUE
);
}
else
{
InterlockedIncrement
(
&
wait
->
waiters
);
vlc_mutex_unlock
(
lock
);
result
=
vlc_WaitForSingleObject
(
wait
->
semaphore
,
delay
);
}
vlc_mutex_lock
(
lock
);
if
(
result
==
WAIT_IO_COMPLETION
)
vlc_testcancel
();
return
(
result
==
WAIT_TIMEOUT
)
?
ETIMEDOUT
:
0
;
}
}
/*** Semaphore ***/
/*** Semaphore ***/
...
...
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