Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
270e1cb5
Commit
270e1cb5
authored
Dec 08, 2002
by
Christophe Massiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New vlc_thread_set_priority function, to set the priority of the main
thread.
parent
ec518727
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
5 deletions
+41
-5
include/vlc_threads_funcs.h
include/vlc_threads_funcs.h
+9
-1
src/libvlc.c
src/libvlc.c
+3
-2
src/misc/threads.c
src/misc/threads.c
+29
-2
No files found.
include/vlc_threads_funcs.h
View file @
270e1cb5
...
...
@@ -3,7 +3,7 @@
* This header provides a portable threads implementation.
*****************************************************************************
* Copyright (C) 1999, 2002 VideoLAN
* $Id: vlc_threads_funcs.h,v 1.
9 2002/11/11 14:39:11 sam
Exp $
* $Id: vlc_threads_funcs.h,v 1.
10 2002/12/08 00:41:06 massiot
Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@via.ecp.fr>
...
...
@@ -35,9 +35,11 @@ VLC_EXPORT( int, __vlc_mutex_destroy, ( char *, int, vlc_mutex_t * ) );
VLC_EXPORT
(
int
,
__vlc_cond_init
,
(
vlc_object_t
*
,
vlc_cond_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_cond_destroy
,
(
char
*
,
int
,
vlc_cond_t
*
)
);
VLC_EXPORT
(
int
,
__vlc_thread_create
,
(
vlc_object_t
*
,
char
*
,
int
,
char
*
,
void
*
(
*
)
(
void
*
),
int
,
vlc_bool_t
)
);
VLC_EXPORT
(
int
,
__vlc_thread_set_priority
,
(
vlc_object_t
*
,
char
*
,
int
,
int
)
);
VLC_EXPORT
(
void
,
__vlc_thread_ready
,
(
vlc_object_t
*
)
);
VLC_EXPORT
(
void
,
__vlc_thread_join
,
(
vlc_object_t
*
,
char
*
,
int
)
);
/*****************************************************************************
* vlc_threads_init: initialize threads system
*****************************************************************************/
...
...
@@ -684,6 +686,12 @@ static inline int __vlc_cond_wait( char * psz_file, int i_line,
#define vlc_thread_create( P_THIS, PSZ_NAME, FUNC, PRIORITY, WAIT ) \
__vlc_thread_create( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PSZ_NAME, (void * ( * ) ( void * ))FUNC, PRIORITY, WAIT )
/*****************************************************************************
* vlc_thread_set_priority: set the priority of the calling thread
*****************************************************************************/
#define vlc_thread_set_priority( P_THIS, PRIORITY ) \
__vlc_thread_set_priority( VLC_OBJECT(P_THIS), __FILE__, __LINE__, PRIORITY )
/*****************************************************************************
* vlc_thread_ready: tell the parent thread we were successfully spawned
*****************************************************************************/
...
...
src/libvlc.c
View file @
270e1cb5
...
...
@@ -2,7 +2,7 @@
* libvlc.c: main libvlc source
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
* $Id: libvlc.c,v 1.
49 2002/12/03 16:29:04 gitan
Exp $
* $Id: libvlc.c,v 1.
50 2002/12/08 00:41:06 massiot
Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -763,7 +763,8 @@ int VLC_Play( int i_object )
VLC_AddIntf
(
0
,
"sap"
,
VLC_FALSE
);
}
vlc_thread_set_priority
(
p_vlc
,
VLC_THREAD_PRIORITY_LOW
);
p_playlist
=
vlc_object_find
(
p_vlc
,
VLC_OBJECT_PLAYLIST
,
FIND_CHILD
);
if
(
!
p_playlist
)
...
...
src/misc/threads.c
View file @
270e1cb5
...
...
@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.2
7 2002/12/06 10:10:40 sam
Exp $
* $Id: threads.c,v 1.2
8 2002/12/08 00:41:06 massiot
Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
...
...
@@ -612,7 +612,8 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
param
.
sched_priority
=
i_priority
;
if
(
pthread_setschedparam
(
p_this
->
thread_id
,
SCHED_RR
,
&
param
)
)
{
msg_Warn
(
p_this
,
"couldn't go to real-time priority"
);
msg_Warn
(
p_this
,
"couldn't go to real-time priority (%s:%d)"
,
psz_file
,
i_line
);
i_priority
=
0
;
}
}
...
...
@@ -670,6 +671,32 @@ int __vlc_thread_create( vlc_object_t *p_this, char * psz_file, int i_line,
return
i_ret
;
}
/*****************************************************************************
* vlc_thread_set_priority: set the priority of the current thread when we
* couldn't set it in vlc_thread_create (for instance for the main thread)
*****************************************************************************/
int
__vlc_thread_set_priority
(
vlc_object_t
*
p_this
,
char
*
psz_file
,
int
i_line
,
int
i_priority
)
{
#if defined( WIN32 ) || defined( UNDER_CE )
/* FIXME: implement it under Win32 ! */
#elif defined( PTHREAD_COND_T_IN_PTHREAD_H )
if
(
i_priority
)
{
struct
sched_param
param
;
memset
(
&
param
,
0
,
sizeof
(
struct
sched_param
)
);
param
.
sched_priority
=
i_priority
;
if
(
pthread_setschedparam
(
pthread_self
(),
SCHED_RR
,
&
param
)
)
{
msg_Warn
(
p_this
,
"couldn't go to real-time priority (%s:%d)"
,
psz_file
,
i_line
);
i_priority
=
0
;
}
}
#endif
}
/*****************************************************************************
* vlc_thread_ready: tell the parent thread we were successfully spawned
*****************************************************************************/
...
...
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