Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2016-10-13 08:56:43 +0000
committerJan Belle2016-10-13 08:56:43 +0000
commit0723a9ccc971b0be4c108447ecb02f9842b49ac5 (patch)
tree47cf205fc1bceb1856d8c7beae887e958647afab /runtime/org.eclipse.etrice.runtime.c/src/platforms
parente95149d57a7df0981f1cf8aae1212e13772c14c7 (diff)
downloadorg.eclipse.etrice-0723a9ccc971b0be4c108447ecb02f9842b49ac5.tar.gz
org.eclipse.etrice-0723a9ccc971b0be4c108447ecb02f9842b49ac5.tar.xz
org.eclipse.etrice-0723a9ccc971b0be4c108447ecb02f9842b49ac5.zip
[runtime.c] Minor changes in the posix implementation of etThread
[runtime.cpp.tests] Fixed MessageDispatcherTest and RTObjectTest Added documentation for CppCheck, GnuCoverage, Valgrind memcheck Change-Id: Idc12f40c8f3c8c5bbeedeec020519521f706060d
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
index cb4beb29a..f3c5b0452 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etThread.c
@@ -64,12 +64,13 @@ void etThread_start(etThread* self) {
self->priority = maxPriority;
param.sched_priority = self->priority;
+ pthread_attr_init(&attr);
pthread_attr_setschedparam(&attr, &param);
pthread_attr_setschedpolicy(&attr, policy);
pthread_attr_setstacksize(&attr, self->stacksize);
- /* TODO: attr doesn't work */
- pthread_create(&(self->osData), NULL/*&attr*/, (threadFunc) etThread_execute, self);
+ pthread_create(&(self->osData), &attr, (threadFunc) etThread_execute, self);
+ pthread_attr_destroy(&attr);
}
ET_MSC_LOGGER_SYNC_EXIT
}
@@ -84,14 +85,13 @@ void* etThread_execute(etThread* self){
void etThread_destruct(etThread* self){
ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct")
- pthread_cancel(self->osData);
+ pthread_detach(self->osData);
ET_MSC_LOGGER_SYNC_EXIT
}
void etThread_sleep(etInt32 millis){
ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
{
- /* TODO: nanosleep doesn't work at all */
struct timespec time;
time.tv_sec = millis / 1000;
time.tv_nsec = (millis - time.tv_sec * 1000) * 1000*1000;
@@ -99,9 +99,6 @@ void etThread_sleep(etInt32 millis){
if(errno != EINTR)
break;
}
-// if (millis<1000)
-// millis = 1000;
-// sleep(millis/1000);
}
ET_MSC_LOGGER_SYNC_EXIT
}

Back to the top