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
15f16798
Commit
15f16798
authored
Aug 01, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: no need to put thread function into vlc_thread_t
parent
28150f2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
11 deletions
+31
-11
include/vlc_threads.h
include/vlc_threads.h
+1
-2
src/misc/w32thread.c
src/misc/w32thread.c
+30
-9
No files found.
include/vlc_threads.h
View file @
15f16798
...
...
@@ -129,8 +129,7 @@ struct vlc_timer_t
typedef
struct
{
HANDLE
handle
;
void
*
(
*
entry
)
(
void
*
);
void
*
data
;
void
*
result
;
#if defined( UNDER_CE )
HANDLE
cancel_event
;
#endif
...
...
src/misc/w32thread.c
View file @
15f16798
...
...
@@ -407,16 +407,27 @@ void vlc_threads_setup (libvlc_int_t *p_libvlc)
(
void
)
p_libvlc
;
}
static
unsigned
__stdcall
vlc_entry
(
void
*
data
)
struct
vlc_entry_data
{
vlc_thread_t
handle
;
void
*
(
*
func
)
(
void
*
);
void
*
data
;
};
static
unsigned
__stdcall
vlc_entry
(
void
*
p
)
{
vlc_cancel_t
cancel_data
=
VLC_CANCEL_INIT
;
vlc_thread_t
self
=
data
;
struct
vlc_entry_data
data
;
memcpy
(
&
data
,
p
,
sizeof
(
data
));
free
(
p
);
#ifdef UNDER_CE
cancel_data
.
cancel_event
=
self
->
cancel_event
;
cancel_data
.
cancel_event
=
data
.
handle
->
cancel_event
;
#endif
vlc_threadvar_set
(
cancel_key
,
&
cancel_data
);
self
->
data
=
self
->
entry
(
self
->
data
);
data
.
handle
->
result
=
data
.
func
(
data
.
data
);
return
0
;
}
...
...
@@ -433,19 +444,28 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
if
(
th
==
NULL
)
return
ENOMEM
;
th
->
data
=
data
;
th
->
entry
=
entry
;
struct
vlc_entry_data
*
entry_data
=
malloc
(
sizeof
(
*
entry_data
));
if
(
entry_data
==
NULL
)
{
free
(
th
);
return
ENOMEM
;
}
entry_data
->
handle
=
th
;
entry_data
->
func
=
entry
;
entry_data
->
data
=
data
;
#if defined( UNDER_CE )
th
->
cancel_event
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
th
->
cancel_event
==
NULL
)
{
free
(
th
);
free
(
entry_data
);
return
errno
;
}
hThread
=
CreateThread
(
NULL
,
128
*
1024
,
vlc_entry
,
th
,
CREATE_SUSPENDED
,
NULL
);
hThread
=
CreateThread
(
NULL
,
128
*
1024
,
vlc_entry
,
entry_data
,
CREATE_SUSPENDED
,
NULL
);
#else
hThread
=
(
HANDLE
)(
uintptr_t
)
_beginthreadex
(
NULL
,
0
,
vlc_entry
,
th
,
CREATE_SUSPENDED
,
NULL
);
_beginthreadex
(
NULL
,
0
,
vlc_entry
,
entry_data
,
CREATE_SUSPENDED
,
NULL
);
#endif
if
(
hThread
)
...
...
@@ -459,6 +479,7 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
{
CloseHandle
(
hThread
);
free
(
th
);
free
(
entry_data
);
return
ENOMEM
;
}
#else
...
...
@@ -485,7 +506,7 @@ void vlc_join (vlc_thread_t handle, void **result)
CloseHandle
(
handle
->
handle
);
if
(
result
)
*
result
=
handle
->
data
;
*
result
=
handle
->
result
;
#ifdef UNDER_CE
CloseHandle
(
handle
->
cancel_event
);
#endif
...
...
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