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
13f0c6d0
Commit
13f0c6d0
authored
Oct 13, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Timer: do not run concurrently
This is useless and awkward.
parent
6f2119ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
34 deletions
+5
-34
src/misc/pthread.c
src/misc/pthread.c
+5
-34
No files found.
src/misc/pthread.c
View file @
13f0c6d0
...
...
@@ -801,7 +801,6 @@ struct vlc_timer
{
vlc_thread_t
thread
;
vlc_mutex_t
lock
;
vlc_cond_t
wait
;
void
(
*
func
)
(
void
*
);
void
*
data
;
mtime_t
value
,
interval
;
...
...
@@ -809,20 +808,6 @@ struct vlc_timer
vlc_atomic_t
overruns
;
};
static
void
*
vlc_timer_do
(
void
*
data
)
{
struct
vlc_timer
*
timer
=
data
;
timer
->
func
(
timer
->
data
);
vlc_mutex_lock
(
&
timer
->
lock
);
assert
(
timer
->
users
>
0
);
if
(
--
timer
->
users
==
0
)
vlc_cond_signal
(
&
timer
->
wait
);
vlc_mutex_unlock
(
&
timer
->
lock
);
return
NULL
;
}
static
void
*
vlc_timer_thread
(
void
*
data
)
{
struct
vlc_timer
*
timer
=
data
;
...
...
@@ -835,19 +820,11 @@ static void *vlc_timer_thread (void *data)
for
(;;)
{
vlc_thread_t
th
;
mwait
(
value
);
vlc_mutex_lock
(
&
timer
->
lock
);
if
(
vlc_clone
(
&
th
,
vlc_timer_do
,
timer
,
VLC_THREAD_PRIORITY_INPUT
))
vlc_atomic_inc
(
&
timer
->
overruns
);
else
{
vlc_detach
(
th
);
timer
->
users
++
;
}
vlc_mutex_unlock
(
&
timer
->
lock
);
int
canc
=
vlc_savecancel
();
timer
->
func
(
timer
->
data
);
vlc_restorecancel
(
canc
);
if
(
interval
==
0
)
return
NULL
;
...
...
@@ -870,7 +847,8 @@ static void *vlc_timer_thread (void *data)
/**
* Initializes an asynchronous timer.
* @warning Asynchronous timers are processed from an unspecified thread.
* Also, multiple occurences of an interval timer can run concurrently.
* Multiple occurences of a single interval timer are serialized; they cannot
* run concurrently.
*
* @param id pointer to timer to be initialized
* @param func function that the timer will call
...
...
@@ -884,7 +862,6 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
if
(
unlikely
(
timer
==
NULL
))
return
ENOMEM
;
vlc_mutex_init
(
&
timer
->
lock
);
vlc_cond_init
(
&
timer
->
wait
);
assert
(
func
);
timer
->
func
=
func
;
timer
->
data
=
data
;
...
...
@@ -908,12 +885,6 @@ int vlc_timer_create (vlc_timer_t *id, void (*func) (void *), void *data)
void
vlc_timer_destroy
(
vlc_timer_t
timer
)
{
vlc_timer_schedule
(
timer
,
false
,
0
,
0
);
vlc_mutex_lock
(
&
timer
->
lock
);
while
(
timer
->
users
!=
0
)
vlc_cond_wait
(
&
timer
->
wait
,
&
timer
->
lock
);
vlc_mutex_unlock
(
&
timer
->
lock
);
vlc_cond_destroy
(
&
timer
->
wait
);
vlc_mutex_destroy
(
&
timer
->
lock
);
free
(
timer
);
}
...
...
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