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
6fdf44fd
Commit
6fdf44fd
authored
Aug 20, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: use only one condition variable per R/W lock
parent
fd42ed01
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
14 deletions
+9
-14
configure.ac
configure.ac
+1
-1
include/vlc_threads.h
include/vlc_threads.h
+2
-3
src/win32/thread.c
src/win32/thread.c
+6
-10
No files found.
configure.ac
View file @
6fdf44fd
...
...
@@ -320,7 +320,7 @@ case "${host_os}" in
*mingw32* | *cygwin* | *wince* | *mingwce*)
AC_CHECK_TOOL(WINDRES, windres, :)
AC_CHECK_TOOL(OBJCOPY, objcopy, :)
AC_DEFINE([_WIN32_WINNT], 0x0
501, [Define to '0x0501' for Windows XP
APIs.])
AC_DEFINE([_WIN32_WINNT], 0x0
600, [Define to '0x0600' for Windows Vista
APIs.])
AC_DEFINE([_WIN32_IE], 0x0501, [Define to '0x0501' for IE 5.01 (and shell) APIs.])
case "${host_os}" in
...
...
include/vlc_threads.h
View file @
6fdf44fd
...
...
@@ -151,14 +151,13 @@ typedef HANDLE vlc_sem_t;
typedef
struct
{
vlc_mutex_t
mutex
;
vlc_cond_t
read_wait
;
vlc_cond_t
write_wait
;
vlc_cond_t
wait
;
unsigned
long
readers
;
unsigned
long
writers
;
DWORD
writer
;
}
vlc_rwlock_t
;
#define VLC_STATIC_RWLOCK \
{ VLC_STATIC_MUTEX, VLC_STATIC_COND,
VLC_STATIC_COND,
0, 0, 0 }
{ VLC_STATIC_MUTEX, VLC_STATIC_COND, 0, 0, 0 }
typedef
struct
vlc_threadvar
*
vlc_threadvar_t
;
typedef
struct
vlc_timer
*
vlc_timer_t
;
...
...
src/win32/thread.c
View file @
6fdf44fd
...
...
@@ -384,8 +384,7 @@ void vlc_sem_wait (vlc_sem_t *sem)
void
vlc_rwlock_init
(
vlc_rwlock_t
*
lock
)
{
vlc_mutex_init
(
&
lock
->
mutex
);
vlc_cond_init
(
&
lock
->
read_wait
);
vlc_cond_init
(
&
lock
->
write_wait
);
vlc_cond_init
(
&
lock
->
wait
);
lock
->
readers
=
0
;
/* active readers */
lock
->
writers
=
0
;
/* waiting writers */
lock
->
writer
=
0
;
/* ID of active writer */
...
...
@@ -393,8 +392,7 @@ void vlc_rwlock_init (vlc_rwlock_t *lock)
void
vlc_rwlock_destroy
(
vlc_rwlock_t
*
lock
)
{
vlc_cond_destroy
(
&
lock
->
read_wait
);
vlc_cond_destroy
(
&
lock
->
write_wait
);
vlc_cond_destroy
(
&
lock
->
wait
);
vlc_mutex_destroy
(
&
lock
->
mutex
);
}
...
...
@@ -411,7 +409,7 @@ void vlc_rwlock_rdlock (vlc_rwlock_t *lock)
while
(
lock
->
writer
!=
0
)
{
assert
(
lock
->
readers
==
0
);
vlc_cond_wait
(
&
lock
->
read_
wait
,
&
lock
->
mutex
);
vlc_cond_wait
(
&
lock
->
wait
,
&
lock
->
mutex
);
}
if
(
unlikely
(
lock
->
readers
==
ULONG_MAX
))
abort
();
...
...
@@ -426,7 +424,7 @@ static void vlc_rwlock_rdunlock (vlc_rwlock_t *lock)
/* If there are no readers left, wake up a writer. */
if
(
--
lock
->
readers
==
0
&&
lock
->
writers
>
0
)
vlc_cond_signal
(
&
lock
->
w
rite_w
ait
);
vlc_cond_signal
(
&
lock
->
wait
);
vlc_mutex_unlock
(
&
lock
->
mutex
);
}
...
...
@@ -438,7 +436,7 @@ void vlc_rwlock_wrlock (vlc_rwlock_t *lock)
lock
->
writers
++
;
/* Wait until nobody owns the lock in either way. */
while
((
lock
->
readers
>
0
)
||
(
lock
->
writer
!=
0
))
vlc_cond_wait
(
&
lock
->
w
rite_w
ait
,
&
lock
->
mutex
);
vlc_cond_wait
(
&
lock
->
wait
,
&
lock
->
mutex
);
lock
->
writers
--
;
assert
(
lock
->
writer
==
0
);
lock
->
writer
=
GetCurrentThreadId
();
...
...
@@ -453,9 +451,7 @@ static void vlc_rwlock_wrunlock (vlc_rwlock_t *lock)
lock
->
writer
=
0
;
/* Write unlock */
/* Let reader and writer compete. Scheduler decides who wins. */
if
(
lock
->
writers
>
0
)
vlc_cond_signal
(
&
lock
->
write_wait
);
vlc_cond_broadcast
(
&
lock
->
read_wait
);
vlc_cond_broadcast
(
&
lock
->
wait
);
vlc_mutex_unlock
(
&
lock
->
mutex
);
}
...
...
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