Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
f18b1848
Commit
f18b1848
authored
Aug 01, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: make vlc_thread_t a plain HANDLE (no heap alloc)
parent
84a6069c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
28 deletions
+7
-28
include/vlc_threads.h
include/vlc_threads.h
+1
-7
src/misc/w32thread.c
src/misc/w32thread.c
+6
-21
No files found.
include/vlc_threads.h
View file @
f18b1848
...
@@ -126,13 +126,7 @@ struct vlc_timer_t
...
@@ -126,13 +126,7 @@ struct vlc_timer_t
};
};
#elif defined( WIN32 )
#elif defined( WIN32 )
typedef
struct
typedef
HANDLE
vlc_thread_t
;
{
HANDLE
handle
;
#if defined( UNDER_CE )
HANDLE
cancel_event
;
#endif
}
*
vlc_thread_t
;
typedef
struct
typedef
struct
{
{
...
...
src/misc/w32thread.c
View file @
f18b1848
...
@@ -409,9 +409,8 @@ void vlc_threads_setup (libvlc_int_t *p_libvlc)
...
@@ -409,9 +409,8 @@ void vlc_threads_setup (libvlc_int_t *p_libvlc)
struct
vlc_entry_data
struct
vlc_entry_data
{
{
vlc_thread_t
handle
;
void
*
(
*
func
)
(
void
*
);
void
*
(
*
func
)
(
void
*
);
void
*
data
;
void
*
data
;
};
};
static
unsigned
__stdcall
vlc_entry
(
void
*
p
)
static
unsigned
__stdcall
vlc_entry
(
void
*
p
)
...
@@ -439,18 +438,10 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
...
@@ -439,18 +438,10 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
* memory leaks and the signal functions not working (see Microsoft
* memory leaks and the signal functions not working (see Microsoft
* Knowledge Base, article 104641) */
* Knowledge Base, article 104641) */
HANDLE
hThread
;
HANDLE
hThread
;
vlc_thread_t
th
=
malloc
(
sizeof
(
*
th
));
if
(
th
==
NULL
)
return
ENOMEM
;
struct
vlc_entry_data
*
entry_data
=
malloc
(
sizeof
(
*
entry_data
));
struct
vlc_entry_data
*
entry_data
=
malloc
(
sizeof
(
*
entry_data
));
if
(
entry_data
==
NULL
)
if
(
entry_data
==
NULL
)
{
free
(
th
);
return
ENOMEM
;
return
ENOMEM
;
}
entry_data
->
handle
=
th
;
entry_data
->
func
=
entry
;
entry_data
->
func
=
entry
;
entry_data
->
data
=
data
;
entry_data
->
data
=
data
;
...
@@ -458,7 +449,6 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
...
@@ -458,7 +449,6 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
th
->
cancel_event
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
th
->
cancel_event
=
CreateEvent
(
NULL
,
FALSE
,
FALSE
,
NULL
);
if
(
th
->
cancel_event
==
NULL
)
if
(
th
->
cancel_event
==
NULL
)
{
{
free
(
th
);
free
(
entry_data
);
free
(
entry_data
);
return
errno
;
return
errno
;
}
}
...
@@ -474,11 +464,10 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
...
@@ -474,11 +464,10 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
/* Thread closes the handle when exiting, duplicate it here
/* Thread closes the handle when exiting, duplicate it here
* to be on the safe side when joining. */
* to be on the safe side when joining. */
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
hThread
,
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
hThread
,
GetCurrentProcess
(),
&
th
->
handle
,
0
,
FALSE
,
GetCurrentProcess
(),
p_
handle
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
DUPLICATE_SAME_ACCESS
))
{
{
CloseHandle
(
hThread
);
CloseHandle
(
hThread
);
free
(
th
);
free
(
entry_data
);
free
(
entry_data
);
return
ENOMEM
;
return
ENOMEM
;
}
}
...
@@ -489,11 +478,8 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
...
@@ -489,11 +478,8 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
ResumeThread
(
hThread
);
ResumeThread
(
hThread
);
if
(
priority
)
if
(
priority
)
SetThreadPriority
(
hThread
,
priority
);
SetThreadPriority
(
hThread
,
priority
);
*
p_handle
=
th
;
return
0
;
return
0
;
}
}
free
(
th
);
return
errno
;
return
errno
;
}
}
...
@@ -501,15 +487,14 @@ void vlc_join (vlc_thread_t handle, void **result)
...
@@ -501,15 +487,14 @@ void vlc_join (vlc_thread_t handle, void **result)
{
{
do
do
vlc_testcancel
();
vlc_testcancel
();
while
(
WaitForSingleObjectEx
(
handle
->
handle
,
INFINITE
,
TRUE
)
while
(
WaitForSingleObjectEx
(
handle
,
INFINITE
,
TRUE
)
==
WAIT_IO_COMPLETION
);
==
WAIT_IO_COMPLETION
);
CloseHandle
(
handle
->
handle
);
CloseHandle
(
handle
);
assert
(
result
==
NULL
);
/* <- FIXME if ever needed */
assert
(
result
==
NULL
);
/* <- FIXME if ever needed */
#ifdef UNDER_CE
#ifdef UNDER_CE
CloseHandle
(
handle
->
cancel_event
);
CloseHandle
(
handle
->
cancel_event
);
#endif
#endif
free
(
handle
);
}
}
...
@@ -525,7 +510,7 @@ static void CALLBACK vlc_cancel_self (ULONG_PTR dummy)
...
@@ -525,7 +510,7 @@ static void CALLBACK vlc_cancel_self (ULONG_PTR dummy)
void
vlc_cancel
(
vlc_thread_t
thread_id
)
void
vlc_cancel
(
vlc_thread_t
thread_id
)
{
{
#ifndef UNDER_CE
#ifndef UNDER_CE
QueueUserAPC
(
vlc_cancel_self
,
thread_id
->
handle
,
0
);
QueueUserAPC
(
vlc_cancel_self
,
thread_id
,
0
);
#else
#else
SetEvent
(
thread_id
->
cancel_event
);
SetEvent
(
thread_id
->
cancel_event
);
#endif
#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