Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
lizhongxiao
OpenXG-RAN
Commits
5ee4b081
Commit
5ee4b081
authored
Jan 22, 2024
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
threadCreate(): print function names and ret/errno consistently in error case
parent
7af4b83e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
common/utils/system.c
common/utils/system.c
+7
-6
No files found.
common/utils/system.c
View file @
5ee4b081
...
...
@@ -230,7 +230,7 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
int
ret
;
int
settingPriority
=
1
;
ret
=
pthread_attr_init
(
&
attr
);
AssertFatal
(
ret
==
0
,
"ret: %d, errno: %d
\n
"
,
ret
,
errno
);
AssertFatal
(
ret
==
0
,
"Error in pthread_attr_init(): ret: %d, errno: %d
\n
"
,
ret
,
errno
);
LOG_I
(
UTIL
,
"Creating thread %s with affinity %d and priority %d
\n
"
,
name
,
affinity
,
priority
);
...
...
@@ -241,9 +241,9 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
if
(
settingPriority
)
{
ret
=
pthread_attr_setinheritsched
(
&
attr
,
PTHREAD_EXPLICIT_SCHED
);
AssertFatal
(
ret
==
0
,
"ret: %d, errno: %d
\n
"
,
ret
,
errno
);
AssertFatal
(
ret
==
0
,
"Error in pthread_attr_setinheritsched(): ret: %d, errno: %d
\n
"
,
ret
,
errno
);
ret
=
pthread_attr_setschedpolicy
(
&
attr
,
SCHED_OAI
);
AssertFatal
(
ret
==
0
,
"ret: %d, errno: %d
\n
"
,
ret
,
errno
);
AssertFatal
(
ret
==
0
,
"Error in pthread_attr_setschedpolicy(): ret: %d, errno: %d
\n
"
,
ret
,
errno
);
if
(
priority
<
sched_get_priority_min
(
SCHED_OAI
)
||
priority
>
sched_get_priority_max
(
SCHED_OAI
))
{
LOG_E
(
UTIL
,
"Prio not possible: %d, min is %d, max: %d, forced in the range
\n
"
,
priority
,
...
...
@@ -258,19 +258,20 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
struct
sched_param
sparam
=
{
0
};
sparam
.
sched_priority
=
priority
;
ret
=
pthread_attr_setschedparam
(
&
attr
,
&
sparam
);
AssertFatal
(
ret
==
0
,
"ret: %d, errno: %d
\n
"
,
ret
,
errno
);
AssertFatal
(
ret
==
0
,
"Error in pthread_attr_setschedparam(): ret: %d errno: %d
\n
"
,
ret
,
errno
);
}
LOG_I
(
UTIL
,
"threadCreate for %s, affinity %x, priority %d
\n
"
,
name
,
affinity
,
priority
);
ret
=
pthread_create
(
t
,
&
attr
,
func
,
param
);
AssertFatal
(
ret
==
0
,
"ret: %d, errno: %d
\n
"
,
ret
,
errno
);
AssertFatal
(
ret
==
0
,
"Error in pthread_create(): ret: %d, errno: %d
\n
"
,
ret
,
errno
);
pthread_setname_np
(
*
t
,
name
);
if
(
affinity
!=
-
1
)
{
cpu_set_t
cpuset
;
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
affinity
,
&
cpuset
);
AssertFatal
(
pthread_setaffinity_np
(
*
t
,
sizeof
(
cpu_set_t
),
&
cpuset
)
==
0
,
"Error setting processor affinity"
);
ret
=
pthread_setaffinity_np
(
*
t
,
sizeof
(
cpu_set_t
),
&
cpuset
);
AssertFatal
(
ret
==
0
,
"Error in pthread_getaffinity_np(): ret: %d, errno: %d"
,
ret
,
errno
);
}
pthread_attr_destroy
(
&
attr
);
}
...
...
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