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
a323173f
Commit
a323173f
authored
Aug 02, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup vlc_timer_* prototypes
parent
c159f79f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
40 deletions
+31
-40
include/vlc_threads.h
include/vlc_threads.h
+3
-3
modules/access/dvdnav.c
modules/access/dvdnav.c
+2
-2
modules/access/rtp/input.c
modules/access/rtp/input.c
+3
-3
modules/access/screen/xcb.c
modules/access/screen/xcb.c
+3
-3
modules/misc/screensaver.c
modules/misc/screensaver.c
+2
-2
src/misc/pthread.c
src/misc/pthread.c
+7
-12
src/misc/w32thread.c
src/misc/w32thread.c
+4
-8
src/test/timer.c
src/test/timer.c
+7
-7
No files found.
include/vlc_threads.h
View file @
a323173f
...
...
@@ -175,9 +175,9 @@ VLC_EXPORT( void, vlc_join, (vlc_thread_t, void **) );
VLC_EXPORT
(
void
,
vlc_control_cancel
,
(
int
cmd
,
...));
VLC_EXPORT
(
int
,
vlc_timer_create
,
(
vlc_timer_t
*
,
void
(
*
)
(
void
*
),
void
*
)
LIBVLC_USED
);
VLC_EXPORT
(
void
,
vlc_timer_destroy
,
(
vlc_timer_t
*
)
);
VLC_EXPORT
(
void
,
vlc_timer_schedule
,
(
vlc_timer_t
*
,
bool
,
mtime_t
,
mtime_t
)
);
VLC_EXPORT
(
unsigned
,
vlc_timer_getoverrun
,
(
const
vlc_timer_t
*
)
LIBVLC_USED
);
VLC_EXPORT
(
void
,
vlc_timer_destroy
,
(
vlc_timer_t
)
);
VLC_EXPORT
(
void
,
vlc_timer_schedule
,
(
vlc_timer_t
,
bool
,
mtime_t
,
mtime_t
)
);
VLC_EXPORT
(
unsigned
,
vlc_timer_getoverrun
,
(
vlc_timer_t
)
LIBVLC_USED
);
#ifndef LIBVLC_USE_PTHREAD_CANCEL
enum
{
...
...
modules/access/dvdnav.c
View file @
a323173f
...
...
@@ -385,7 +385,7 @@ static void Close( vlc_object_t *p_this )
/* Stop still image handler */
if
(
p_sys
->
still
.
b_created
)
vlc_timer_destroy
(
&
p_sys
->
still
.
timer
);
vlc_timer_destroy
(
p_sys
->
still
.
timer
);
vlc_mutex_destroy
(
&
p_sys
->
still
.
lock
);
var_Destroy
(
p_sys
->
p_input
,
"highlight-mutex"
);
...
...
@@ -638,7 +638,7 @@ static int Demux( demux_t *p_demux )
if
(
event
->
length
!=
0xff
&&
p_sys
->
still
.
b_created
)
{
mtime_t
delay
=
event
->
length
*
CLOCK_FREQ
;
vlc_timer_schedule
(
&
p_sys
->
still
.
timer
,
false
,
delay
,
0
);
vlc_timer_schedule
(
p_sys
->
still
.
timer
,
false
,
delay
,
0
);
}
b_still_init
=
true
;
...
...
modules/access/rtp/input.c
View file @
a323173f
...
...
@@ -163,7 +163,7 @@ static block_t *rtp_recv (demux_t *demux)
static
void
timer_cleanup
(
void
*
timer
)
{
vlc_timer_destroy
(
timer
);
vlc_timer_destroy
(
(
vlc_timer_t
)
timer
);
}
static
void
rtp_process
(
void
*
data
);
...
...
@@ -176,7 +176,7 @@ void *rtp_thread (void *data)
if
(
vlc_timer_create
(
&
p_sys
->
timer
,
rtp_process
,
data
))
return
NULL
;
vlc_cleanup_push
(
timer_cleanup
,
&
p_sys
->
timer
);
vlc_cleanup_push
(
timer_cleanup
,
(
void
*
)
p_sys
->
timer
);
for
(;;)
{
...
...
@@ -217,6 +217,6 @@ static void rtp_process (void *data)
vlc_mutex_lock
(
&
p_sys
->
lock
);
if
(
rtp_dequeue
(
demux
,
p_sys
->
session
,
&
deadline
))
vlc_timer_schedule
(
&
p_sys
->
timer
,
true
,
deadline
,
0
);
vlc_timer_schedule
(
p_sys
->
timer
,
true
,
deadline
,
0
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
modules/access/screen/xcb.c
View file @
a323173f
...
...
@@ -244,7 +244,7 @@ static int Open (vlc_object_t *obj)
vlc_mutex_init
(
&
p_sys
->
lock
);
if
(
vlc_timer_create
(
&
p_sys
->
timer
,
Demux
,
demux
))
goto
error
;
vlc_timer_schedule
(
&
p_sys
->
timer
,
false
,
1
,
p_sys
->
interval
);
vlc_timer_schedule
(
p_sys
->
timer
,
false
,
1
,
p_sys
->
interval
);
/* Initializes demux */
demux
->
pf_demux
=
NULL
;
...
...
@@ -266,7 +266,7 @@ static void Close (vlc_object_t *obj)
demux_t
*
demux
=
(
demux_t
*
)
obj
;
demux_sys_t
*
p_sys
=
demux
->
p_sys
;
vlc_timer_destroy
(
&
p_sys
->
timer
);
vlc_timer_destroy
(
p_sys
->
timer
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
xcb_disconnect
(
p_sys
->
conn
);
free
(
p_sys
);
...
...
@@ -324,7 +324,7 @@ static int Control (demux_t *demux, int query, va_list args)
es_out_Control
(
demux
->
out
,
ES_OUT_RESET_PCR
);
vlc_mutex_unlock
(
&
p_sys
->
lock
);
}
vlc_timer_schedule
(
&
p_sys
->
timer
,
false
,
vlc_timer_schedule
(
p_sys
->
timer
,
false
,
pausing
?
0
:
1
,
p_sys
->
interval
);
return
VLC_SUCCESS
;
}
...
...
modules/misc/screensaver.c
View file @
a323173f
...
...
@@ -112,7 +112,7 @@ static int Activate( vlc_object_t *p_this )
free
(
p_sys
);
return
VLC_ENOMEM
;
}
vlc_timer_schedule
(
&
p_sys
->
timer
,
false
,
30
*
CLOCK_FREQ
,
30
*
CLOCK_FREQ
);
vlc_timer_schedule
(
p_sys
->
timer
,
false
,
30
*
CLOCK_FREQ
,
30
*
CLOCK_FREQ
);
#ifdef HAVE_DBUS
p_sys
->
p_connection
=
dbus_init
(
p_intf
);
...
...
@@ -128,7 +128,7 @@ static void Deactivate( vlc_object_t *p_this )
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_this
;
intf_sys_t
*
p_sys
=
p_intf
->
p_sys
;
vlc_timer_destroy
(
&
p_sys
->
timer
);
vlc_timer_destroy
(
p_sys
->
timer
);
#ifdef HAVE_DBUS
if
(
p_sys
->
p_connection
)
dbus_connection_unref
(
p_sys
->
p_connection
);
...
...
src/misc/pthread.c
View file @
a323173f
...
...
@@ -775,13 +775,11 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
* @warning This function <b>must</b> be called before the timer data can be
* freed and before the timer callback function can be unloaded.
*
* @param timer to destroy
* @param timer t
imer t
o destroy
*/
void
vlc_timer_destroy
(
vlc_timer_t
*
id
)
void
vlc_timer_destroy
(
vlc_timer_t
timer
)
{
struct
vlc_timer
*
timer
=
*
id
;
vlc_timer_schedule
(
id
,
false
,
0
,
0
);
vlc_timer_schedule
(
timer
,
false
,
0
,
0
);
vlc_mutex_lock
(
&
timer
->
lock
);
while
(
timer
->
users
!=
0
)
vlc_cond_wait
(
&
timer
->
wait
,
&
timer
->
lock
);
...
...
@@ -801,7 +799,7 @@ void vlc_timer_destroy (vlc_timer_t *id)
* the system is busy or suspended, or because a previous iteration of the
* timer is still running. See also vlc_timer_getoverrun().
*
* @param
id initialized timer point
er
* @param
timer initialized tim
er
* @param absolute the timer value origin is the same as mdate() if true,
* the timer value is relative to now if false.
* @param value zero to disarm the timer, otherwise the initial time to wait
...
...
@@ -809,11 +807,9 @@ void vlc_timer_destroy (vlc_timer_t *id)
* @param interval zero to fire the timer just once, otherwise the timer
* repetition interval.
*/
void
vlc_timer_schedule
(
vlc_timer_t
*
id
,
bool
absolute
,
void
vlc_timer_schedule
(
vlc_timer_t
timer
,
bool
absolute
,
mtime_t
value
,
mtime_t
interval
)
{
struct
vlc_timer
*
timer
=
*
id
;
vlc_mutex_lock
(
&
timer
->
lock
);
if
(
timer
->
value
)
{
...
...
@@ -833,14 +829,13 @@ void vlc_timer_schedule (vlc_timer_t *id, bool absolute,
/**
* Fetch and reset the overrun counter for a timer.
* @param
id initialized timer point
er
* @param
timer initialized tim
er
* @return the timer overrun counter, i.e. the number of times that the timer
* should have run but did not since the last actual run. If all is well, this
* is zero.
*/
unsigned
vlc_timer_getoverrun
(
const
vlc_timer_t
*
id
)
unsigned
vlc_timer_getoverrun
(
vlc_timer_t
timer
)
{
struct
vlc_timer
*
timer
=
*
id
;
unsigned
ret
;
vlc_mutex_lock
(
&
timer
->
lock
);
...
...
src/misc/w32thread.c
View file @
a323173f
...
...
@@ -629,20 +629,16 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
return
0
;
}
void
vlc_timer_destroy
(
vlc_timer_t
*
id
)
void
vlc_timer_destroy
(
vlc_timer_t
timer
)
{
struct
vlc_timer
*
timer
=
*
id
;
if
(
timer
->
handle
!=
INVALID_HANDLE_VALUE
)
DeleteTimerQueueTimer
(
NULL
,
timer
->
handle
,
INVALID_HANDLE_VALUE
);
free
(
timer
);
}
void
vlc_timer_schedule
(
vlc_timer_t
*
id
,
bool
absolute
,
void
vlc_timer_schedule
(
vlc_timer_t
timer
,
bool
absolute
,
mtime_t
value
,
mtime_t
interval
)
{
struct
vlc_timer
*
timer
=
*
id
;
if
(
timer
->
handle
!=
INVALID_HANDLE_VALUE
)
{
DeleteTimerQueueTimer
(
NULL
,
timer
->
handle
,
NULL
);
...
...
@@ -660,8 +656,8 @@ void vlc_timer_schedule (vlc_timer_t *id, bool absolute,
abort
();
}
unsigned
vlc_timer_getoverrun
(
const
vlc_timer_t
*
id
)
unsigned
vlc_timer_getoverrun
(
vlc_timer_t
timer
)
{
(
void
)
id
;
(
void
)
timer
;
return
0
;
}
src/test/timer.c
View file @
a323173f
...
...
@@ -41,7 +41,7 @@ static void callback (void *ptr)
struct
timer_data
*
data
=
ptr
;
vlc_mutex_lock
(
&
data
->
lock
);
data
->
count
+=
1
+
vlc_timer_getoverrun
(
&
data
->
timer
);
data
->
count
+=
1
+
vlc_timer_getoverrun
(
data
->
timer
);
vlc_mutex_unlock
(
&
data
->
lock
);
}
...
...
@@ -58,28 +58,28 @@ int main (void)
assert
(
val
==
0
);
/* Relative timer */
vlc_timer_schedule
(
&
data
.
timer
,
false
,
1
,
CLOCK_FREQ
/
10
);
vlc_timer_schedule
(
data
.
timer
,
false
,
1
,
CLOCK_FREQ
/
10
);
msleep
(
CLOCK_FREQ
);
vlc_mutex_lock
(
&
data
.
lock
);
data
.
count
+=
vlc_timer_getoverrun
(
&
data
.
timer
);
data
.
count
+=
vlc_timer_getoverrun
(
data
.
timer
);
printf
(
"Count = %u
\n
"
,
data
.
count
);
assert
(
data
.
count
>=
10
);
data
.
count
=
0
;
vlc_mutex_unlock
(
&
data
.
lock
);
vlc_timer_schedule
(
&
data
.
timer
,
false
,
0
,
0
);
vlc_timer_schedule
(
data
.
timer
,
false
,
0
,
0
);
/* Absolute timer */
mtime_t
now
=
mdate
();
vlc_timer_schedule
(
&
data
.
timer
,
true
,
now
,
CLOCK_FREQ
/
10
);
vlc_timer_schedule
(
data
.
timer
,
true
,
now
,
CLOCK_FREQ
/
10
);
msleep
(
CLOCK_FREQ
);
vlc_mutex_lock
(
&
data
.
lock
);
data
.
count
+=
vlc_timer_getoverrun
(
&
data
.
timer
);
data
.
count
+=
vlc_timer_getoverrun
(
data
.
timer
);
printf
(
"Count = %u
\n
"
,
data
.
count
);
assert
(
data
.
count
>=
10
);
vlc_mutex_unlock
(
&
data
.
lock
);
vlc_timer_destroy
(
&
data
.
timer
);
vlc_timer_destroy
(
data
.
timer
);
vlc_mutex_destroy
(
&
data
.
lock
);
return
0
;
...
...
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