Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
f4ad7994
Commit
f4ad7994
authored
Aug 27, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: do not assume the thread is joined before it exits
parent
f18192c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
src/misc/threads.c
src/misc/threads.c
+15
-15
No files found.
src/misc/threads.c
View file @
f4ad7994
...
...
@@ -527,19 +527,30 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
if
(
hThread
)
{
/* Thread closes the handle when exiting, duplicate it here
* to be on the safe side when joining. */
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
hThread
,
GetCurrentProcess
(),
&
th
->
handle
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
{
CloseHandle
(
hThread
);
free
(
th
);
return
ENOMEM
;
}
ResumeThread
(
hThread
);
th
->
handle
=
hThread
;
if
(
priority
)
SetThreadPriority
(
hThread
,
priority
);
ret
=
0
;
*
p_handle
=
th
;
}
else
{
ret
=
errno
;
free
(
th
);
th
=
NULL
;
}
*
p_handle
=
th
;
#elif defined( HAVE_KERNEL_SCHEDULER_H )
*
p_handle
=
spawn_thread
(
entry
,
psz_name
,
priority
,
data
);
...
...
@@ -561,19 +572,8 @@ int vlc_join (vlc_thread_t handle, void **result)
return
pthread_join
(
handle
,
result
);
#elif defined( UNDER_CE ) || defined( WIN32 )
HANDLE
hThread
;
/*
** object will close its thread handle when destroyed, duplicate it here
** to be on the safe side
*/
if
(
!
DuplicateHandle
(
GetCurrentProcess
(),
handle
->
handle
,
GetCurrentProcess
(),
&
hThread
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
return
GetLastError
();
/* FIXME: errno */
WaitForSingleObject
(
hThread
,
INFINITE
);
CloseHandle
(
hThread
);
WaitForSingleObject
(
handle
->
handle
,
INFINITE
);
CloseHandle
(
handle
->
handle
);
if
(
result
)
*
result
=
handle
->
data
;
free
(
handle
);
...
...
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