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
2efddef0
Commit
2efddef0
authored
Jun 06, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set the thread priority before its creation
This should avoid priority inversion.
parent
6145aa22
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
24 deletions
+14
-24
src/misc/threads.c
src/misc/threads.c
+14
-24
No files found.
src/misc/threads.c
View file @
2efddef0
...
@@ -490,8 +490,10 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
...
@@ -490,8 +490,10 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
vlc_mutex_lock
(
&
p_this
->
object_lock
);
vlc_mutex_lock
(
&
p_this
->
object_lock
);
#if defined( LIBVLC_USE_PTHREAD )
#if defined( LIBVLC_USE_PTHREAD )
sigset_t
set
,
oldset
;
pthread_attr_t
attr
;
pthread_attr_init
(
&
attr
);
sigset_t
set
,
oldset
;
/* We really don't want signals to (literaly) interrupt our blocking I/O
/* We really don't want signals to (literaly) interrupt our blocking I/O
* system calls. SIGPIPE is especially bad, as it can be caused by remote
* system calls. SIGPIPE is especially bad, as it can be caused by remote
* peers through connected sockets. Generally, we cannot know which signals
* peers through connected sockets. Generally, we cannot know which signals
...
@@ -507,42 +509,30 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
...
@@ -507,42 +509,30 @@ int __vlc_thread_create( vlc_object_t *p_this, const char * psz_file, int i_line
sigdelset
(
&
set
,
SIGBUS
);
sigdelset
(
&
set
,
SIGBUS
);
pthread_sigmask
(
SIG_BLOCK
,
&
set
,
&
oldset
);
pthread_sigmask
(
SIG_BLOCK
,
&
set
,
&
oldset
);
i_ret
=
pthread_create
(
&
p_priv
->
thread_id
,
NULL
,
thread_entry
,
boot
);
pthread_sigmask
(
SIG_SETMASK
,
&
oldset
,
NULL
);
#ifndef __APPLE__
#ifndef __APPLE__
if
(
config_GetInt
(
p_this
,
"rt-priority"
)
>
0
)
if
(
config_GetInt
(
p_this
,
"rt-priority"
)
>
0
)
#endif
#endif
{
{
int
i_error
,
i_policy
;
/* Hack to avoid error msg */
struct
sched_param
param
;
memset
(
&
param
,
0
,
sizeof
(
struct
sched_param
)
);
if
(
config_GetType
(
p_this
,
"rt-offset"
)
)
if
(
config_GetType
(
p_this
,
"rt-offset"
)
)
i_priority
+=
config_GetInt
(
p_this
,
"rt-offset"
);
i_priority
+=
config_GetInt
(
p_this
,
"rt-offset"
);
if
(
i_priority
<=
0
)
if
(
i_priority
<=
0
)
{
{
param
.
sched_priority
=
(
-
1
)
*
i_priority
;
struct
sched_param
param
=
{
.
sched_priority
=
-
i_priority
,
};
i_policy
=
SCHED_OTHER
;
pthread_attr_setschedpolicy
(
&
attr
,
SCHED_OTHER
);
pthread_attr_setschedparam
(
&
attr
,
&
param
);
}
}
else
else
{
{
param
.
sched_priority
=
i_priority
;
struct
sched_param
param
=
{
.
sched_priority
=
+
i_priority
,
};
i_policy
=
SCHED_RR
;
pthread_attr_setschedpolicy
(
&
attr
,
SCHED_OTHER
);
}
pthread_attr_setschedparam
(
&
attr
,
&
param
);
if
(
(
i_error
=
pthread_setschedparam
(
p_priv
->
thread_id
,
i_policy
,
&
param
))
)
{
errno
=
i_error
;
msg_Warn
(
p_this
,
"couldn't set thread priority (%s:%d): %m"
,
psz_file
,
i_line
);
i_priority
=
0
;
}
}
}
}
#ifndef __APPLE__
else
i_ret
=
pthread_create
(
&
p_priv
->
thread_id
,
&
attr
,
thread_entry
,
boot
);
i_priority
=
0
;
pthread_sigmask
(
SIG_SETMASK
,
&
oldset
,
NULL
)
;
#endif
pthread_attr_destroy
(
&
attr
);
#elif defined( WIN32 ) || defined( UNDER_CE )
#elif defined( WIN32 ) || defined( UNDER_CE )
{
{
...
...
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