Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
ef0b207a
Commit
ef0b207a
authored
Jan 22, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove State Threads support
parent
8b672857
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
137 deletions
+39
-137
configure.ac
configure.ac
+17
-39
include/vlc_threads.h
include/vlc_threads.h
+2
-22
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+7
-27
src/misc/mtime.c
src/misc/mtime.c
+0
-3
src/misc/threads.c
src/misc/threads.c
+13
-46
No files found.
configure.ac
View file @
ef0b207a
...
...
@@ -741,49 +741,27 @@ fi
dnl Check for cthreads under GNU/Hurd for instance
AC_CHECK_LIB(threads,cthread_fork,THREAD_LIB="-lthreads")
dnl
dnl State Threads
dnl
AC_ARG_ENABLE(st,
[ --enable-st State Threads (default disabled)],
[ if test "${enable_st}" = "yes"; then
AC_CHECK_LIB(st,st_init)
AC_MSG_CHECKING(for st_init in st.h)
AC_EGREP_HEADER(st_init,st.h,[
AC_MSG_RESULT(yes)
AC_DEFINE(ST_INIT_IN_ST_H, 1,
Define if <st.h> defines st_init)
THREAD_LIB="-lst"
],[
AC_MSG_RESULT(yes)
])
fi
])
VLC_ADD_LIBS([libvlc plugin],[${THREAD_LIB}])
dnl Don't link with rt when using GNU-pth
if test "${THREAD_LIB}" != "-lst"; then
AC_CHECK_LIB(rt, clock_nanosleep, [
AC_CHECK_LIB(rt, clock_nanosleep, [
VLC_ADD_LIBS([libvlc],[-lrt])
AC_DEFINE(HAVE_CLOCK_NANOSLEEP, 1, [Define to 1 if you have clock_nanosleep.])
], [
], [
dnl HP/UX port
AC_CHECK_LIB(rt,sem_init, [VLC_ADD_LIBS([libvlc],[-lrt])])
])
])
have_nanosleep=false
AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
have_nanosleep=false
AC_CHECK_FUNCS(nanosleep,have_nanosleep=:,[
AC_CHECK_LIB(rt,nanosleep,
[VLC_ADD_LIBS([libvlc],[-lrt]) have_nanosleep=:],
[AC_CHECK_LIB(posix4,nanosleep,
[VLC_ADD_LIBS([libvlc],[-lposix4]) have_nanosleep=:])]
)
])
if ${have_nanosleep}; then
AC_DEFINE(HAVE_NANOSLEEP, 1,
Define if nanosleep is available.)
fi
])
if ${have_nanosleep}; then
AC_DEFINE(HAVE_NANOSLEEP, 1, [Define if nanosleep is available.])
fi
dnl Check for misc headers
...
...
include/vlc_threads.h
View file @
ef0b207a
...
...
@@ -38,10 +38,7 @@
# include <sys/time.h>
#endif
#if defined( ST_INIT_IN_ST_H )
/* State threads */
# include <st.h>
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
/* WinCE API */
#elif defined( WIN32 )
# include <process.h>
/* Win32 API */
...
...
@@ -127,24 +124,7 @@
* Type definitions
*****************************************************************************/
#if defined( ST_INIT_IN_ST_H )
typedef
st_thread_t
vlc_thread_t
;
typedef
struct
{
st_mutex_t
mutex
;
vlc_object_t
*
p_this
;
}
vlc_mutex_t
;
typedef
struct
{
st_cond_t
cond
;
vlc_object_t
*
p_this
;
}
vlc_cond_t
;
typedef
struct
{
int
handle
;
}
vlc_threadvar_t
;
#elif defined( WIN32 ) || defined( UNDER_CE )
#if defined( WIN32 ) || defined( UNDER_CE )
typedef
struct
{
/* thread id */
...
...
include/vlc_threads_funcs.h
View file @
ef0b207a
...
...
@@ -100,10 +100,7 @@ static inline int __vlc_mutex_lock( const char * psz_file, int i_line,
/* In case of error : */
unsigned
long
int
i_thread
=
0
;
#if defined( ST_INIT_IN_ST_H )
i_result
=
st_mutex_lock
(
p_mutex
->
mutex
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
EnterCriticalSection
(
&
p_mutex
->
csection
);
i_result
=
0
;
...
...
@@ -176,10 +173,7 @@ static inline int __vlc_mutex_unlock( const char * psz_file, int i_line,
/* In case of error : */
unsigned
long
int
i_thread
=
0
;
#if defined( ST_INIT_IN_ST_H )
i_result
=
st_mutex_unlock
(
p_mutex
->
mutex
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
LeaveCriticalSection
(
&
p_mutex
->
csection
);
i_result
=
0
;
...
...
@@ -259,10 +253,7 @@ static inline int __vlc_cond_signal( const char * psz_file, int i_line,
/* In case of error : */
unsigned
long
int
i_thread
=
0
;
#if defined( ST_INIT_IN_ST_H )
i_result
=
st_cond_signal
(
p_condvar
->
cond
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
PulseEvent
(
p_condvar
->
event
);
i_result
=
0
;
...
...
@@ -391,12 +382,7 @@ static inline int __vlc_cond_wait( const char * psz_file, int i_line,
/* In case of error : */
unsigned
long
int
i_thread
=
0
;
#if defined( ST_INIT_IN_ST_H )
st_mutex_unlock
(
p_mutex
->
mutex
);
i_result
=
st_cond_wait
(
p_condvar
->
cond
);
st_mutex_lock
(
p_mutex
->
mutex
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
p_condvar
->
i_waiting_threads
++
;
LeaveCriticalSection
(
&
p_mutex
->
csection
);
WaitForSingleObject
(
p_condvar
->
event
,
INFINITE
);
...
...
@@ -575,9 +561,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
int
i_res
;
unsigned
long
int
i_thread
=
0
;
#if defined( ST_INIT_IN_ST_H )
# error Unimplemented
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
mtime_t
delay_ms
=
(
deadline
-
mdate
())
/
1000
;
DWORD
result
;
...
...
@@ -738,9 +722,7 @@ static inline int vlc_threadvar_set( vlc_threadvar_t * p_tls, void *p_value )
{
int
i_ret
;
#if defined( ST_INIT_IN_ST_H )
return
st_thread_setspecific
(
p_tls
->
handle
,
p_value
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( HAVE_KERNEL_SCHEDULER_H )
return
-
1
;
#elif defined( UNDER_CE ) || defined( WIN32 )
...
...
@@ -763,9 +745,7 @@ static inline void* vlc_threadvar_get( vlc_threadvar_t * p_tls )
{
void
*
p_ret
;
#if defined( ST_INIT_IN_ST_H )
p_ret
=
st_thread_getspecific
(
p_handle
->
key
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( HAVE_KERNEL_SCHEDULER_H )
p_ret
=
NULL
;
#elif defined( UNDER_CE ) || defined( WIN32 )
p_ret
=
TlsGetValue
(
p_tls
->
handle
);
...
...
src/misc/mtime.c
View file @
ef0b207a
...
...
@@ -326,9 +326,6 @@ void msleep( mtime_t delay )
#elif defined( HAVE_KERNEL_OS_H )
snooze
(
delay
);
#elif defined( ST_INIT_IN_ST_H )
st_usleep
(
delay
);
#elif defined( WIN32 ) || defined( UNDER_CE )
Sleep
(
(
int
)
(
delay
/
1000
)
);
...
...
src/misc/threads.c
View file @
ef0b207a
...
...
@@ -44,8 +44,7 @@ static volatile unsigned i_initializations = 0;
static
volatile
int
i_status
=
VLC_THREADS_UNINITIALIZED
;
static
vlc_object_t
*
p_root
;
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
#elif defined( WIN32 )
/* following is only available on NT/2000/XP and above */
...
...
@@ -104,8 +103,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* If we have lazy mutex initialization, use it. Otherwise, we just
* hope nothing wrong happens. */
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
#elif defined( WIN32 )
if
(
IsDebuggerPresent
()
)
{
...
...
@@ -126,10 +124,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* We should be safe now. Do all the initialization stuff we want. */
p_libvlc_global
->
b_ready
=
VLC_FALSE
;
#if defined( ST_INIT_IN_ST_H )
i_ret
=
st_init
();
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
/* Nothing to initialize */
#elif defined( WIN32 )
...
...
@@ -177,9 +172,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
/* If we have lazy mutex initialization support, unlock the mutex;
* otherwize, do a naive wait loop. */
#if defined( ST_INIT_IN_ST_H )
while
(
i_status
==
VLC_THREADS_PENDING
)
msleep
(
THREAD_SLEEP
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
while
(
i_status
==
VLC_THREADS_PENDING
)
msleep
(
THREAD_SLEEP
);
#elif defined( WIN32 )
while
(
i_status
==
VLC_THREADS_PENDING
)
msleep
(
THREAD_SLEEP
);
...
...
@@ -207,8 +200,7 @@ int __vlc_threads_init( vlc_object_t *p_this )
int
__vlc_threads_end
(
vlc_object_t
*
p_this
)
{
(
void
)
p_this
;
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
...
...
@@ -226,8 +218,7 @@ int __vlc_threads_end( vlc_object_t *p_this )
vlc_object_destroy
(
p_root
);
}
#if defined( ST_INIT_IN_ST_H )
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
#elif defined( WIN32 )
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
...
...
@@ -245,11 +236,7 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
assert
(
p_this
);
p_mutex
->
p_this
=
p_this
;
#if defined( ST_INIT_IN_ST_H )
p_mutex
->
mutex
=
st_mutex_new
();
return
(
p_mutex
->
mutex
==
NULL
)
?
errno
:
0
;
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
InitializeCriticalSection
(
&
p_mutex
->
csection
);
return
0
;
...
...
@@ -363,10 +350,7 @@ int __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mutex
/* In case of error : */
int
i_thread
=
-
1
;
#if defined( ST_INIT_IN_ST_H )
i_result
=
st_mutex_destroy
(
p_mutex
->
mutex
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
DeleteCriticalSection
(
&
p_mutex
->
csection
);
return
0
;
...
...
@@ -420,11 +404,7 @@ int __vlc_cond_init( vlc_object_t *p_this, vlc_cond_t *p_condvar )
{
p_condvar
->
p_this
=
p_this
;
#if defined( ST_INIT_IN_ST_H )
p_condvar
->
cond
=
st_cond_new
();
return
(
p_condvar
->
cond
==
NULL
)
?
errno
:
0
;
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
/* Initialize counter */
p_condvar
->
i_waiting_threads
=
0
;
...
...
@@ -531,10 +511,7 @@ int __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condvar
/* In case of error : */
int
i_thread
=
-
1
;
#if defined( ST_INIT_IN_ST_H )
i_result
=
st_cond_destroy
(
p_condvar
->
cond
);
#elif defined( UNDER_CE )
#if defined( UNDER_CE )
i_result
=
!
CloseHandle
(
p_condvar
->
event
);
#elif defined( WIN32 )
...
...
@@ -585,8 +562,6 @@ int __vlc_threadvar_create( vlc_object_t *p_this, vlc_threadvar_t *p_tls )
#if defined( HAVE_KERNEL_SCHEDULER_H )
msg_Err
(
p_this
,
"TLS not implemented"
);
i_ret
VLC_EGENERIC
;
#elif defined( ST_INIT_IN_ST_H )
i_ret
=
st_key_create
(
&
p_tls
->
handle
,
NULL
);
#elif defined( UNDER_CE ) || defined( WIN32 )
#elif defined( WIN32 )
p_tls
->
handle
=
TlsAlloc
();
...
...
@@ -616,11 +591,7 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
vlc_mutex_lock
(
&
p_this
->
object_lock
);
#if defined( ST_INIT_IN_ST_H )
p_priv
->
thread_id
=
st_thread_create
(
func
,
p_data
,
1
,
0
);
i_ret
=
0
;
#elif defined( WIN32 ) || defined( UNDER_CE )
#if defined( WIN32 ) || defined( UNDER_CE )
{
/* When using the MSVCRT C library you have to use the _beginthreadex
* function instead of CreateThread, otherwise you'll end up with
...
...
@@ -749,8 +720,7 @@ int __vlc_thread_set_priority( vlc_object_t *p_this, const char * psz_file,
int
i_line
,
int
i_priority
)
{
vlc_object_internals_t
*
p_priv
=
p_this
->
p_internals
;
#if defined( ST_INIT_IN_ST_H )
#elif defined( WIN32 ) || defined( UNDER_CE )
#if defined( WIN32 ) || defined( UNDER_CE )
if
(
!
p_priv
->
thread_id
.
hThread
)
p_priv
->
thread_id
.
hThread
=
GetCurrentThread
();
if
(
!
SetThreadPriority
(
p_priv
->
thread_id
.
hThread
,
i_priority
)
)
...
...
@@ -887,10 +857,7 @@ void __vlc_thread_join( vlc_object_t *p_this, const char * psz_file, int i_line
int
i_ret
=
0
;
#if defined( ST_INIT_IN_ST_H )
i_ret
=
st_thread_join
(
p_priv
->
thread_id
,
NULL
);
#elif defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( HAVE_KERNEL_SCHEDULER_H )
int32_t
exit_value
;
i_ret
=
(
B_OK
==
wait_for_thread
(
p_priv
->
thread_id
,
&
exit_value
));
...
...
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