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
cc6e3d03
Commit
cc6e3d03
authored
Feb 17, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused object pointer from condition vars, mutexes and thread vars
parent
0774c40b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
36 deletions
+16
-36
include/vlc_modules_macros.h
include/vlc_modules_macros.h
+2
-2
include/vlc_threads.h
include/vlc_threads.h
+0
-10
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+8
-8
src/misc/threads.c
src/misc/threads.c
+6
-16
No files found.
include/vlc_modules_macros.h
View file @
cc6e3d03
...
@@ -35,8 +35,8 @@
...
@@ -35,8 +35,8 @@
/**
/**
* Current plugin ABI version
* Current plugin ABI version
*/
*/
# define MODULE_SYMBOL 0_9_0
f
# define MODULE_SYMBOL 0_9_0
g
# define MODULE_SUFFIX "__0_9_0
f
"
# define MODULE_SUFFIX "__0_9_0
g
"
/*****************************************************************************
/*****************************************************************************
* Add a few defines. You do not want to read this section. Really.
* Add a few defines. You do not want to read this section. Really.
...
...
include/vlc_threads.h
View file @
cc6e3d03
...
@@ -133,8 +133,6 @@ typedef struct
...
@@ -133,8 +133,6 @@ typedef struct
HANDLE
mutex
;
HANDLE
mutex
;
/* Win95/98/ME implementation */
/* Win95/98/ME implementation */
CRITICAL_SECTION
csection
;
CRITICAL_SECTION
csection
;
vlc_object_t
*
p_this
;
}
vlc_mutex_t
;
}
vlc_mutex_t
;
typedef
struct
typedef
struct
...
@@ -147,8 +145,6 @@ typedef struct
...
@@ -147,8 +145,6 @@ typedef struct
HANDLE
semaphore
;
HANDLE
semaphore
;
CRITICAL_SECTION
csection
;
CRITICAL_SECTION
csection
;
int
i_win9x_cv
;
int
i_win9x_cv
;
vlc_object_t
*
p_this
;
}
vlc_cond_t
;
}
vlc_cond_t
;
typedef
struct
typedef
struct
...
@@ -167,16 +163,12 @@ typedef struct
...
@@ -167,16 +163,12 @@ typedef struct
{
{
int32_t
init
;
int32_t
init
;
sem_id
lock
;
sem_id
lock
;
vlc_object_t
*
p_this
;
}
vlc_mutex_t
;
}
vlc_mutex_t
;
typedef
struct
typedef
struct
{
{
int32_t
init
;
int32_t
init
;
thread_id
thread
;
thread_id
thread
;
vlc_object_t
*
p_this
;
}
vlc_cond_t
;
}
vlc_cond_t
;
typedef
struct
typedef
struct
...
@@ -189,12 +181,10 @@ typedef pthread_t vlc_thread_t;
...
@@ -189,12 +181,10 @@ typedef pthread_t vlc_thread_t;
typedef
struct
typedef
struct
{
{
pthread_mutex_t
mutex
;
pthread_mutex_t
mutex
;
vlc_object_t
*
p_this
;
}
vlc_mutex_t
;
}
vlc_mutex_t
;
typedef
struct
typedef
struct
{
{
pthread_cond_t
cond
;
pthread_cond_t
cond
;
vlc_object_t
*
p_this
;
}
vlc_cond_t
;
}
vlc_cond_t
;
typedef
struct
typedef
struct
...
...
include/vlc_threads_funcs.h
View file @
cc6e3d03
...
@@ -35,12 +35,12 @@
...
@@ -35,12 +35,12 @@
/*****************************************************************************
/*****************************************************************************
* Function definitions
* Function definitions
*****************************************************************************/
*****************************************************************************/
VLC_EXPORT
(
int
,
__vlc_mutex_init
,
(
vlc_
object_t
*
,
vlc_
mutex_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_mutex_init
,
(
vlc_mutex_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_mutex_init_recursive
,
(
vlc_
object_t
*
,
vlc_
mutex_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_mutex_init_recursive
,
(
vlc_mutex_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_mutex_destroy
,
(
const
char
*
,
int
,
vlc_mutex_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_mutex_destroy
,
(
const
char
*
,
int
,
vlc_mutex_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_cond_init
,
(
vlc_
object_t
*
,
vlc_
cond_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_cond_init
,
(
vlc_cond_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_cond_destroy
,
(
const
char
*
,
int
,
vlc_cond_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_cond_destroy
,
(
const
char
*
,
int
,
vlc_cond_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_threadvar_create
,
(
vlc_
object_t
*
,
vlc_
threadvar_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_threadvar_create
,
(
vlc_threadvar_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_thread_create
,
(
vlc_object_t
*
,
const
char
*
,
int
,
const
char
*
,
void
*
(
*
)
(
void
*
),
int
,
vlc_bool_t
)
);
VLC_EXPORT
(
int
,
__vlc_thread_create
,
(
vlc_object_t
*
,
const
char
*
,
int
,
const
char
*
,
void
*
(
*
)
(
void
*
),
int
,
vlc_bool_t
)
);
VLC_EXPORT
(
int
,
__vlc_thread_set_priority
,
(
vlc_object_t
*
,
const
char
*
,
int
,
int
)
);
VLC_EXPORT
(
int
,
__vlc_thread_set_priority
,
(
vlc_object_t
*
,
const
char
*
,
int
,
int
)
);
VLC_EXPORT
(
void
,
__vlc_thread_ready
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_thread_ready
,
(
vlc_object_t
*
)
);
...
@@ -62,13 +62,13 @@ VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) );
...
@@ -62,13 +62,13 @@ VLC_EXPORT( void, __vlc_thread_join, ( vlc_object_t *, const char *, int ) );
* vlc_mutex_init: initialize a mutex
* vlc_mutex_init: initialize a mutex
*****************************************************************************/
*****************************************************************************/
#define vlc_mutex_init( P_THIS, P_MUTEX ) \
#define vlc_mutex_init( P_THIS, P_MUTEX ) \
__vlc_mutex_init(
VLC_OBJECT(P_THIS),
P_MUTEX )
__vlc_mutex_init( P_MUTEX )
/*****************************************************************************
/*****************************************************************************
* vlc_mutex_init: initialize a recursive mutex (Don't use it)
* vlc_mutex_init: initialize a recursive mutex (Don't use it)
*****************************************************************************/
*****************************************************************************/
#define vlc_mutex_init_recursive( P_THIS, P_MUTEX ) \
#define vlc_mutex_init_recursive( P_THIS, P_MUTEX ) \
__vlc_mutex_init_recursive(
VLC_OBJECT(P_THIS),
P_MUTEX )
__vlc_mutex_init_recursive( P_MUTEX )
/*****************************************************************************
/*****************************************************************************
* vlc_mutex_lock: lock a mutex
* vlc_mutex_lock: lock a mutex
...
@@ -152,7 +152,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
...
@@ -152,7 +152,7 @@ static inline void __vlc_mutex_unlock( const char * psz_file, int i_line,
* vlc_cond_init: initialize a condition
* vlc_cond_init: initialize a condition
*****************************************************************************/
*****************************************************************************/
#define vlc_cond_init( P_THIS, P_COND ) \
#define vlc_cond_init( P_THIS, P_COND ) \
__vlc_cond_init(
VLC_OBJECT(P_THIS),
P_COND )
__vlc_cond_init( P_COND )
/*****************************************************************************
/*****************************************************************************
* vlc_cond_signal: start a thread on condition completion
* vlc_cond_signal: start a thread on condition completion
...
@@ -497,7 +497,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
...
@@ -497,7 +497,7 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
* vlc_threadvar_create: create a thread-local variable
* vlc_threadvar_create: create a thread-local variable
*****************************************************************************/
*****************************************************************************/
#define vlc_threadvar_create( PTHIS, P_TLS ) \
#define vlc_threadvar_create( PTHIS, P_TLS ) \
__vlc_threadvar_create( P
THIS, P
_TLS )
__vlc_threadvar_create( P_TLS )
/*****************************************************************************
/*****************************************************************************
* vlc_threadvar_set: create: set the value of a thread-local variable
* vlc_threadvar_set: create: set the value of a thread-local variable
...
...
src/misc/threads.c
View file @
cc6e3d03
...
@@ -253,10 +253,8 @@ int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
...
@@ -253,10 +253,8 @@ int pthread_mutexattr_setkind_np( pthread_mutexattr_t *attr, int kind );
/*****************************************************************************
/*****************************************************************************
* vlc_mutex_init: initialize a mutex
* vlc_mutex_init: initialize a mutex
*****************************************************************************/
*****************************************************************************/
int
__vlc_mutex_init
(
vlc_
object_t
*
p_this
,
vlc_
mutex_t
*
p_mutex
)
int
__vlc_mutex_init
(
vlc_mutex_t
*
p_mutex
)
{
{
p_mutex
->
p_this
=
p_this
;
#if defined( UNDER_CE )
#if defined( UNDER_CE )
InitializeCriticalSection
(
&
p_mutex
->
csection
);
InitializeCriticalSection
(
&
p_mutex
->
csection
);
return
0
;
return
0
;
...
@@ -327,10 +325,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
...
@@ -327,10 +325,8 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
/*****************************************************************************
/*****************************************************************************
* vlc_mutex_init: initialize a recursive mutex (Do not use)
* vlc_mutex_init: initialize a recursive mutex (Do not use)
*****************************************************************************/
*****************************************************************************/
int
__vlc_mutex_init_recursive
(
vlc_
object_t
*
p_this
,
vlc_
mutex_t
*
p_mutex
)
int
__vlc_mutex_init_recursive
(
vlc_mutex_t
*
p_mutex
)
{
{
p_mutex
->
p_this
=
p_this
;
#if defined( WIN32 )
#if defined( WIN32 )
/* Create mutex returns a recursive mutex */
/* Create mutex returns a recursive mutex */
p_mutex
->
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
p_mutex
->
mutex
=
CreateMutex
(
0
,
FALSE
,
0
);
...
@@ -353,9 +349,7 @@ int __vlc_mutex_init_recursive( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
...
@@ -353,9 +349,7 @@ int __vlc_mutex_init_recursive( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
pthread_mutexattr_destroy
(
&
attr
);
pthread_mutexattr_destroy
(
&
attr
);
return
(
i_result
);
return
(
i_result
);
#else
#else
msg_Err
(
p_this
,
"no recursive mutex found. Falling back to regular mutex.
\n
"
# error Unimplemented!
"Expect hangs
\n
"
)
return
__vlc_mutex_init
(
p_this
,
p_mutex
);
#endif
#endif
}
}
...
@@ -390,10 +384,8 @@ void __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mute
...
@@ -390,10 +384,8 @@ void __vlc_mutex_destroy( const char * psz_file, int i_line, vlc_mutex_t *p_mute
/*****************************************************************************
/*****************************************************************************
* vlc_cond_init: initialize a condition
* vlc_cond_init: initialize a condition
*****************************************************************************/
*****************************************************************************/
int
__vlc_cond_init
(
vlc_
object_t
*
p_this
,
vlc_
cond_t
*
p_condvar
)
int
__vlc_cond_init
(
vlc_cond_t
*
p_condvar
)
{
{
p_condvar
->
p_this
=
p_this
;
#if defined( UNDER_CE )
#if defined( UNDER_CE )
/* Initialize counter */
/* Initialize counter */
p_condvar
->
i_waiting_threads
=
0
;
p_condvar
->
i_waiting_threads
=
0
;
...
@@ -516,14 +508,12 @@ void __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condva
...
@@ -516,14 +508,12 @@ void __vlc_cond_destroy( const char * psz_file, int i_line, vlc_cond_t *p_condva
/*****************************************************************************
/*****************************************************************************
* vlc_tls_create: create a thread-local variable
* vlc_tls_create: create a thread-local variable
*****************************************************************************/
*****************************************************************************/
int
__vlc_threadvar_create
(
vlc_
object_t
*
p_this
,
vlc_
threadvar_t
*
p_tls
)
int
__vlc_threadvar_create
(
vlc_threadvar_t
*
p_tls
)
{
{
int
i_ret
=
-
1
;
int
i_ret
=
-
1
;
(
void
)
p_this
;
#if defined( HAVE_KERNEL_SCHEDULER_H )
#if defined( HAVE_KERNEL_SCHEDULER_H )
msg_Err
(
p_this
,
"TLS not implemented"
);
# error Unimplemented!
i_ret
VLC_EGENERIC
;
#elif defined( UNDER_CE ) || defined( WIN32 )
#elif defined( UNDER_CE ) || defined( WIN32 )
#elif defined( WIN32 )
#elif defined( WIN32 )
p_tls
->
handle
=
TlsAlloc
();
p_tls
->
handle
=
TlsAlloc
();
...
...
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