Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Belle2016-09-28 09:35:20 +0000
committerJan Belle2016-09-29 13:17:02 +0000
commit73efe3ca6ebe2b580e5847b728b8088cba35cc2d (patch)
tree87f8894c0e5900f6fc0aab14820281c692a8c96c /runtime/org.eclipse.etrice.runtime.c/src/platforms
parent22b8e8c7c55e06c6fa040b594bc56f18390b5af8 (diff)
downloadorg.eclipse.etrice-73efe3ca6ebe2b580e5847b728b8088cba35cc2d.tar.gz
org.eclipse.etrice-73efe3ca6ebe2b580e5847b728b8088cba35cc2d.tar.xz
org.eclipse.etrice-73efe3ca6ebe2b580e5847b728b8088cba35cc2d.zip
[runtime.cpp.tests] Initial commit of MessageServiceTest
[runtime.cpp] Changed mutex_leave position in MessageServiceController::terminate() method Changed m_running set to true in MessageService::start() instead of MessageService::run() Fixed double delete of the MessageDispatcher and MessageSeQueue in AbstractMessageService [runtime.c] Changed etThread_sleep(int millis) from using sleep to nanosleep for Linux_Posix Change-Id: Ieccbfebea4eec6c2104a8356fb7948f0f3c3510c Signed-off-by: Jan Belle <jan.belle@protos.de>
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.c18
1 files changed, 11 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 30d920a5b..cb4beb29a 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
@@ -23,6 +23,7 @@
#include <time.h>
#include <sys/unistd.h>
+#include <errno.h>
typedef void *(*threadFunc)(void *);
void* etThread_execute(etThread* self);
@@ -91,13 +92,16 @@ void etThread_sleep(etInt32 millis){
ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
{
/* TODO: nanosleep doesn't work at all */
-/* struct timespec time; */
-/* time.tv_nsec = 1000*1000*millis; */
-/* time.tv_sec = 0; */
-/* nanosleep(&time, NULL); */
- if (millis<1000)
- millis = 1000;
- sleep(millis/1000);
+ struct timespec time;
+ time.tv_sec = millis / 1000;
+ time.tv_nsec = (millis - time.tv_sec * 1000) * 1000*1000;
+ while(nanosleep(&time, &time) != 0) {
+ if(errno != EINTR)
+ break;
+ }
+// if (millis<1000)
+// millis = 1000;
+// sleep(millis/1000);
}
ET_MSC_LOGGER_SYNC_EXIT
}

Back to the top