Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2013-04-29 19:41:43 +0000
committerThomas Schuetz2013-04-29 19:41:43 +0000
commit2903767e47d1d2a6d3135d7a26d2913987792f52 (patch)
tree86d2948ce587c67d289ad1213cae2b6e21a4e801 /runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c
parent8ab083b90fbf7f51e39ad6c9c7ef4cf7c92aae93 (diff)
downloadorg.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.tar.gz
org.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.tar.xz
org.eclipse.etrice-2903767e47d1d2a6d3135d7a26d2913987792f52.zip
[runtime.c] reorganization of API for C OSAL
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c
new file mode 100644
index 000000000..14ea2b98a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etThread.c
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz, Thomas Jung (initial contribution)
+ *
+ *******************************************************************************/
+
+/**
+ *
+ * etThread.c MinGW implementation of etThread
+ *
+ */
+
+#include "osal/etThread.h"
+
+#include "debugging/etLogger.h"
+#include "debugging/etMSCLogger.h"
+
+void etThread_execute(etThread* self);
+
+void etThread_construct(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "construct")
+ self->osData = (HANDLE)_beginthread( (etThreadFunction)etThread_execute, self->stacksize, self );
+ SetThreadPriority(self->osData, self->priority);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_execute(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "execute")
+ /* etThread_execute redirects the call from the thread to the execute function in the eTrice runtime to enable correct synchronous MSC logging */
+ self->threadFunction(self->threadFunctionData);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_destruct(etThread* self){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "destruct")
+ TerminateThread(self->osData, 0);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+void etThread_sleep(etInt32 millis){
+ ET_MSC_LOGGER_SYNC_ENTRY("etThread", "sleep")
+ Sleep(millis);
+ ET_MSC_LOGGER_SYNC_EXIT
+}
+
+etOSThreadData etThread_self(void){
+ return GetCurrentThread();
+}
+
+etOSThreadId etThread_self_id(void){
+ return GetCurrentThreadId();
+}
+

Back to the top