Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openairinterface5G
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
oai
openairinterface5G
Commits
fca094f7
Commit
fca094f7
authored
1 year ago
by
Robert Schmidt
Browse files
Options
Downloads
Patches
Plain Diff
threadCreate(): print function names and ret/errno consistently in error case
parent
47c06934
No related branches found
No related tags found
1 merge request
!2522
Integration of O-RAN 7.2 FH using OSC xRAN library
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
common/utils/system.c
+7
-6
7 additions, 6 deletions
common/utils/system.c
with
7 additions
and
6 deletions
common/utils/system.c
+
7
−
6
View file @
fca094f7
...
...
@@ -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,18 +258,19 @@ 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
);
}
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
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment