Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
66d70fbf
authored
Feb 23, 2016
by
Marcus Winter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
base_c: fixed codesonar warnings
parent
d45dc69d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
base_c/src/thread.c
+13
-2
No files found.
base_c/src/thread.c
View file @
66d70fbf
...
...
@@ -80,7 +80,7 @@ void embb_thread_yield() {
int
embb_thread_create
(
embb_thread_t
*
thread
,
const
embb_core_set_t
*
core_set
,
embb_thread_start_t
func
,
void
*
arg
)
{
assert
(
thread
!=
NULL
)
;
if
(
thread
==
NULL
)
return
EMBB_ERROR
;
thread
->
embb_internal_arg
=
(
embb_internal_thread_arg_t
*
)
embb_alloc
(
sizeof
(
embb_internal_thread_arg_t
));
if
(
thread
->
embb_internal_arg
==
NULL
)
{
...
...
@@ -98,6 +98,8 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
0
,
/* no creation arguments */
0
);
/* no system thread ID */
if
(
thread
->
embb_internal_handle
==
NULL
)
{
embb_free
(
thread
->
embb_internal_arg
);
thread
->
embb_internal_arg
=
NULL
;
return
EMBB_ERROR
;
}
...
...
@@ -121,6 +123,7 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
}
int
embb_thread_join
(
embb_thread_t
*
thread
,
int
*
result_code
)
{
if
(
thread
==
NULL
)
return
EMBB_ERROR
;
BOOL
success
;
DWORD
result
;
result
=
WaitForSingleObject
(
thread
->
embb_internal_handle
,
INFINITE
);
...
...
@@ -206,6 +209,7 @@ void embb_thread_yield() {
int
embb_thread_create
(
embb_thread_t
*
thread
,
const
embb_core_set_t
*
core_set
,
embb_thread_start_t
func
,
void
*
arg
)
{
if
(
thread
==
NULL
)
return
EMBB_ERROR
;
pthread_attr_t
attr
;
/* Used to set thread affinities */
int
status
=
pthread_attr_init
(
&
attr
);
if
(
status
!=
0
)
return
EMBB_ERROR
;
...
...
@@ -226,7 +230,11 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
}
}
status
=
pthread_attr_setaffinity_np
(
&
attr
,
sizeof
(
cpuset
),
&
cpuset
);
if
(
status
!=
0
)
return
EMBB_ERROR
;
if
(
status
!=
0
)
{
thread
->
embb_internal_arg
=
NULL
;
thread
->
embb_internal_handle
=
NULL
;
return
EMBB_ERROR
;
}
#else
embb_log_write
(
"base_c"
,
EMBB_LOG_LEVEL_WARNING
,
"Could not set thread "
"affinity, since no implementation available!
\n
"
);
...
...
@@ -259,11 +267,14 @@ int embb_thread_create(embb_thread_t* thread, const embb_core_set_t* core_set,
int
embb_thread_join
(
embb_thread_t
*
thread
,
int
*
result_code
)
{
int
status
=
0
;
if
(
thread
==
NULL
)
return
EMBB_ERROR
;
status
=
pthread_join
(
thread
->
embb_internal_handle
,
NULL
);
if
(
thread
->
embb_internal_arg
!=
NULL
)
{
if
(
result_code
!=
NULL
)
{
*
result_code
=
thread
->
embb_internal_arg
->
result
;
}
embb_free
(
thread
->
embb_internal_arg
);
}
if
(
status
!=
0
)
{
return
EMBB_ERROR
;
}
...
...
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