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
757e6a6e
Commit
757e6a6e
authored
Dec 05, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "vlc_clone_detach: remove thread handle parameter"
This reverts commit
653a6637
. Conflicts: src/win32/thread.c
parent
c97e1959
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
12 deletions
+31
-12
src/libvlc.h
src/libvlc.h
+1
-1
src/misc/pthread.c
src/misc/pthread.c
+10
-4
src/playlist/fetcher.c
src/playlist/fetcher.c
+2
-1
src/playlist/preparser.c
src/playlist/preparser.c
+2
-1
src/win32/thread.c
src/win32/thread.c
+16
-5
No files found.
src/libvlc.h
View file @
757e6a6e
...
...
@@ -52,7 +52,7 @@ void system_End ( libvlc_int_t * );
*/
/* This cannot be used as is from plugins yet: */
int
vlc_clone_detach
(
void
*
(
*
)(
void
*
),
void
*
,
int
);
int
vlc_clone_detach
(
v
lc_thread_t
*
,
v
oid
*
(
*
)(
void
*
),
void
*
,
int
);
/* Hopefully, no need to export this. There is a new thread API instead. */
void
vlc_thread_cancel
(
vlc_object_t
*
);
...
...
src/misc/pthread.c
View file @
757e6a6e
...
...
@@ -717,7 +717,8 @@ void vlc_join (vlc_thread_t handle, void **result)
* Creates and starts new detached thread.
* A detached thread cannot be joined. Its resources will be automatically
* released whenever the thread exits (in particular, its call stack will be
* reclaimed).
* reclaimed). Nevertheless, a detached thread may
* be cancelled; this can expedite its termination.
*
* Detached thread are particularly useful when some work needs to be done
* asynchronously, that is likely to be completed much earlier than the thread
...
...
@@ -730,19 +731,24 @@ void vlc_join (vlc_thread_t handle, void **result)
* thread. In practice, LibVLC will wait for detached threads to exit before
* it unloads the plugins.
*
* @param th [OUT] pointer to hold the thread handle, or NULL
* @param entry entry point for the thread
* @param data data parameter given to the entry point
* @param priority thread priority value
* @return 0 on success, a standard error code on error.
*/
int
vlc_clone_detach
(
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
int
vlc_clone_detach
(
vlc_thread_t
*
th
,
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
{
vlc_thread_t
th
;
vlc_thread_t
dummy
;
pthread_attr_t
attr
;
if
(
th
==
NULL
)
th
=
&
dummy
;
pthread_attr_init
(
&
attr
);
pthread_attr_setdetachstate
(
&
attr
,
PTHREAD_CREATE_DETACHED
);
return
vlc_clone_attr
(
&
th
,
&
attr
,
entry
,
data
,
priority
);
return
vlc_clone_attr
(
th
,
&
attr
,
entry
,
data
,
priority
);
}
/**
...
...
src/playlist/fetcher.c
View file @
757e6a6e
...
...
@@ -91,7 +91,8 @@ void playlist_fetcher_Push( playlist_fetcher_t *p_fetcher,
p_fetcher
->
i_waiting
,
p_item
);
if
(
!
p_fetcher
->
b_live
)
{
if
(
vlc_clone_detach
(
Thread
,
p_fetcher
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_clone_detach
(
NULL
,
Thread
,
p_fetcher
,
VLC_THREAD_PRIORITY_LOW
)
)
msg_Err
(
p_fetcher
->
p_playlist
,
"cannot spawn secondary preparse thread"
);
else
...
...
src/playlist/preparser.c
View file @
757e6a6e
...
...
@@ -83,7 +83,8 @@ void playlist_preparser_Push( playlist_preparser_t *p_preparser, input_item_t *p
p_preparser
->
i_waiting
,
p_item
);
if
(
!
p_preparser
->
b_live
)
{
if
(
vlc_clone_detach
(
Thread
,
p_preparser
,
VLC_THREAD_PRIORITY_LOW
)
)
if
(
vlc_clone_detach
(
NULL
,
Thread
,
p_preparser
,
VLC_THREAD_PRIORITY_LOW
)
)
msg_Warn
(
p_preparser
->
p_playlist
,
"cannot spawn pre-parser thread"
);
else
...
...
src/win32/thread.c
View file @
757e6a6e
...
...
@@ -563,15 +563,15 @@ static unsigned __stdcall vlc_entry (void *p)
return
0
;
}
int
vlc_clone
(
vlc_thread_t
*
p_handle
,
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
static
int
vlc_clone_attr
(
vlc_thread_t
*
p_handle
,
bool
detached
,
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
{
struct
vlc_thread
*
th
=
malloc
(
sizeof
(
*
th
));
if
(
unlikely
(
th
==
NULL
))
return
ENOMEM
;
th
->
entry
=
entry
;
th
->
data
=
data
;
th
->
detached
=
p_handle
==
NULL
;
th
->
detached
=
detached
;
th
->
killable
=
false
;
/* not until vlc_entry() ! */
th
->
killed
=
false
;
th
->
cleaners
=
NULL
;
...
...
@@ -623,6 +623,12 @@ int vlc_clone (vlc_thread_t *p_handle, void * (*entry) (void *), void *data,
return
0
;
}
int
vlc_clone
(
vlc_thread_t
*
p_handle
,
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
{
return
vlc_clone_attr
(
p_handle
,
false
,
entry
,
data
,
prioity
);
}
void
vlc_join
(
vlc_thread_t
th
,
void
**
result
)
{
do
...
...
@@ -639,9 +645,14 @@ void vlc_join (vlc_thread_t th, void **result)
free
(
th
);
}
int
vlc_clone_detach
(
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
int
vlc_clone_detach
(
vlc_thread_t
*
p_handle
,
void
*
(
*
entry
)
(
void
*
),
void
*
data
,
int
priority
)
{
return
vlc_clone
(
NULL
,
entry
,
data
,
priority
);
vlc_thread_t
th
;
if
(
p_handle
==
NULL
)
p_handle
=
&
th
;
return
vlc_clone_attr
(
p_handle
,
true
,
entry
,
data
,
priority
);
}
/*** Thread cancellation ***/
...
...
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