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
c159f79f
Commit
c159f79f
authored
Aug 02, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: privatize vlc_timer layout too
parent
5dc04132
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
20 deletions
+30
-20
include/vlc_threads.h
include/vlc_threads.h
+1
-8
src/misc/w32thread.c
src/misc/w32thread.c
+29
-12
No files found.
include/vlc_threads.h
View file @
c159f79f
...
...
@@ -134,14 +134,7 @@ typedef struct
}
vlc_rwlock_t
;
typedef
DWORD
vlc_threadvar_t
;
typedef
struct
vlc_timer_t
vlc_timer_t
;
struct
vlc_timer_t
{
HANDLE
handle
;
void
(
*
func
)
(
void
*
);
void
*
data
;
};
typedef
struct
vlc_timer
*
vlc_timer_t
;
#endif
#if defined( WIN32 ) && !defined ETIMEDOUT
...
...
src/misc/w32thread.c
View file @
c159f79f
...
...
@@ -601,35 +601,52 @@ void vlc_control_cancel (int cmd, ...)
/*** Timers ***/
struct
vlc_timer
{
HANDLE
handle
;
void
(
*
func
)
(
void
*
);
void
*
data
;
};
static
void
CALLBACK
vlc_timer_do
(
void
*
val
,
BOOLEAN
timeout
)
{
vlc_timer_t
*
id
=
val
;
struct
vlc_timer
*
timer
=
val
;
assert
(
timeout
);
id
->
func
(
id
->
data
);
timer
->
func
(
timer
->
data
);
}
int
vlc_timer_create
(
vlc_timer_t
*
id
,
void
(
*
func
)
(
void
*
),
void
*
data
)
{
id
->
func
=
func
;
id
->
data
=
data
;
id
->
handle
=
INVALID_HANDLE_VALUE
;
struct
vlc_timer
*
timer
=
malloc
(
sizeof
(
*
timer
));
if
(
timer
==
NULL
)
return
ENOMEM
;
timer
->
func
=
func
;
timer
->
data
=
data
;
timer
->
handle
=
INVALID_HANDLE_VALUE
;
*
id
=
timer
;
return
0
;
}
void
vlc_timer_destroy
(
vlc_timer_t
*
id
)
{
if
(
id
->
handle
!=
INVALID_HANDLE_VALUE
)
DeleteTimerQueueTimer
(
NULL
,
id
->
handle
,
INVALID_HANDLE_VALUE
);
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
,
mtime_t
value
,
mtime_t
interval
)
{
if
(
id
->
handle
!=
INVALID_HANDLE_VALUE
)
struct
vlc_timer
*
timer
=
*
id
;
if
(
timer
->
handle
!=
INVALID_HANDLE_VALUE
)
{
DeleteTimerQueueTimer
(
NULL
,
id
->
handle
,
NULL
);
id
->
handle
=
INVALID_HANDLE_VALUE
;
DeleteTimerQueueTimer
(
NULL
,
timer
->
handle
,
NULL
);
timer
->
handle
=
INVALID_HANDLE_VALUE
;
}
if
(
value
==
0
)
return
;
/* Disarm */
...
...
@@ -638,8 +655,8 @@ void vlc_timer_schedule (vlc_timer_t *id, bool absolute,
value
-=
mdate
();
value
=
(
value
+
999
)
/
1000
;
interval
=
(
interval
+
999
)
/
1000
;
if
(
!
CreateTimerQueueTimer
(
&
id
->
handle
,
NULL
,
vlc_timer_do
,
id
,
value
,
interval
,
WT_EXECUTEDEFAULT
))
if
(
!
CreateTimerQueueTimer
(
&
timer
->
handle
,
NULL
,
vlc_timer_do
,
timer
,
value
,
interval
,
WT_EXECUTEDEFAULT
))
abort
();
}
...
...
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