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
82f89ed6
Commit
82f89ed6
authored
Sep 10, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge Win32 SelectClockSource() into vlc_threads_setup()
Also reorder Win32 functions to avoid forward declarations.
parent
14c1430d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
62 deletions
+59
-62
src/libvlc.c
src/libvlc.c
+1
-5
src/libvlc.h
src/libvlc.h
+0
-1
src/win32/thread.c
src/win32/thread.c
+58
-56
No files found.
src/libvlc.c
View file @
82f89ed6
...
...
@@ -177,9 +177,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
msg_Dbg
(
p_libvlc
,
"%s"
,
COPYRIGHT_MESSAGE
);
msg_Dbg
(
p_libvlc
,
"revision %s"
,
psz_vlc_changeset
);
msg_Dbg
(
p_libvlc
,
"configured with %s"
,
CONFIGURE_LINE
);
#ifdef WIN32
SelectClockSource
(
VLC_OBJECT
(
p_libvlc
));
#endif
vlc_threads_setup
(
p_libvlc
);
/* Load the builtins and plugins into the module_bank.
* We have to do it before config_Load*() because this also gets the
...
...
@@ -400,8 +398,6 @@ dbus_out:
var_SetInteger
(
p_libvlc
,
"verbose"
,
-
1
);
priv
->
i_verbose
=
-
1
;
}
vlc_threads_setup
(
p_libvlc
);
if
(
priv
->
b_color
)
priv
->
b_color
=
var_InheritBool
(
p_libvlc
,
"color"
);
...
...
src/libvlc.h
View file @
82f89ed6
...
...
@@ -43,7 +43,6 @@ void system_Init ( void );
void
system_Configure
(
libvlc_int_t
*
,
int
,
const
char
*
const
[]
);
#ifdef WIN32
void
system_End
(
void
);
void
SelectClockSource
(
vlc_object_t
*
);
size_t
EnumClockSource
(
vlc_object_t
*
,
char
***
,
char
***
);
#endif
void
vlc_CPU_init
(
void
);
...
...
src/win32/thread.c
View file @
82f89ed6
...
...
@@ -37,62 +37,12 @@
#include <limits.h>
#include <errno.h>
static
vlc_threadvar_t
thread_key
;
/**
* Per-thread data
*/
struct
vlc_thread
{
HANDLE
id
;
bool
detached
;
bool
killable
;
bool
killed
;
vlc_cleanup_t
*
cleaners
;
void
*
(
*
entry
)
(
void
*
);
void
*
data
;
};
static
CRITICAL_SECTION
clock_lock
;
/*** Static mutex and condition variable ***/
static
vlc_mutex_t
super_mutex
;
static
vlc_cond_t
super_variable
;
extern
vlc_rwlock_t
config_lock
,
msg_lock
;
BOOL
WINAPI
DllMain
(
HINSTANCE
,
DWORD
,
LPVOID
);
BOOL
WINAPI
DllMain
(
HINSTANCE
hinstDll
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
{
(
void
)
hinstDll
;
(
void
)
lpvReserved
;
switch
(
fdwReason
)
{
case
DLL_PROCESS_ATTACH
:
InitializeCriticalSection
(
&
clock_lock
);
vlc_mutex_init
(
&
super_mutex
);
vlc_cond_init
(
&
super_variable
);
vlc_threadvar_create
(
&
thread_key
,
NULL
);
vlc_rwlock_init
(
&
config_lock
);
vlc_rwlock_init
(
&
msg_lock
);
vlc_CPU_init
();
break
;
case
DLL_PROCESS_DETACH
:
vlc_rwlock_destroy
(
&
msg_lock
);
vlc_rwlock_destroy
(
&
config_lock
);
vlc_threadvar_delete
(
&
thread_key
);
vlc_cond_destroy
(
&
super_variable
);
vlc_mutex_destroy
(
&
super_mutex
);
DeleteCriticalSection
(
&
clock_lock
);
break
;
}
return
TRUE
;
}
static
void
CALLBACK
vlc_cancel_self
(
ULONG_PTR
);
/*** Common helpers ***/
static
DWORD
vlc_WaitForMultipleObjects
(
DWORD
count
,
const
HANDLE
*
handles
,
DWORD
delay
)
{
...
...
@@ -494,10 +444,21 @@ void *vlc_threadvar_get (vlc_threadvar_t key)
}
/*** Threads ***/
void
vlc_threads_setup
(
libvlc_int_t
*
p_libvlc
)
static
vlc_threadvar_t
thread_key
;
/** Per-thread data */
struct
vlc_thread
{
(
void
)
p_libvlc
;
}
HANDLE
id
;
bool
detached
;
bool
killable
;
bool
killed
;
vlc_cleanup_t
*
cleaners
;
void
*
(
*
entry
)
(
void
*
);
void
*
data
;
};
static
void
vlc_thread_cleanup
(
struct
vlc_thread
*
th
)
{
...
...
@@ -703,6 +664,8 @@ void vlc_control_cancel (int cmd, ...)
}
/*** Clock ***/
static
CRITICAL_SECTION
clock_lock
;
static
mtime_t
mdate_giveup
(
void
)
{
abort
();
...
...
@@ -828,7 +791,7 @@ void msleep (mtime_t delay)
mwait
(
mdate
()
+
delay
);
}
void
SelectClockSource
(
vlc_object_t
*
obj
)
static
void
SelectClockSource
(
vlc_object_t
*
obj
)
{
EnterCriticalSection
(
&
clock_lock
);
if
(
mdate_selected
!=
mdate_giveup
)
...
...
@@ -1029,3 +992,42 @@ unsigned vlc_GetCPUCount (void)
return
popcount
(
system
);
return
1
;
}
/*** Initialization ***/
void
vlc_threads_setup
(
libvlc_int_t
*
p_libvlc
)
{
SelectClockSource
(
VLC_OBJECT
(
p_libvlc
));
}
extern
vlc_rwlock_t
config_lock
,
msg_lock
;
BOOL
WINAPI
DllMain
(
HINSTANCE
,
DWORD
,
LPVOID
);
BOOL
WINAPI
DllMain
(
HINSTANCE
hinstDll
,
DWORD
fdwReason
,
LPVOID
lpvReserved
)
{
(
void
)
hinstDll
;
(
void
)
lpvReserved
;
switch
(
fdwReason
)
{
case
DLL_PROCESS_ATTACH
:
InitializeCriticalSection
(
&
clock_lock
);
vlc_mutex_init
(
&
super_mutex
);
vlc_cond_init
(
&
super_variable
);
vlc_threadvar_create
(
&
thread_key
,
NULL
);
vlc_rwlock_init
(
&
config_lock
);
vlc_rwlock_init
(
&
msg_lock
);
vlc_CPU_init
();
break
;
case
DLL_PROCESS_DETACH
:
vlc_rwlock_destroy
(
&
msg_lock
);
vlc_rwlock_destroy
(
&
config_lock
);
vlc_threadvar_delete
(
&
thread_key
);
vlc_cond_destroy
(
&
super_variable
);
vlc_mutex_destroy
(
&
super_mutex
);
DeleteCriticalSection
(
&
clock_lock
);
break
;
}
return
TRUE
;
}
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