commit 1bfc6b251d276d88d84e911b110ef42afe82eb5d
Author: skenneweg <skenneweg@techfak.uni-bielefeld.de>
Date:   Tue Jun 9 16:32:58 2020 +0200

    Do some work for the node:
    Fixed some Todos in main function
    Fixed error in the struct in the header file

diff --git a/inc/urt_node.h b/inc/urt_node.h
index ee9df81..f3b1481 100644
--- a/inc/urt_node.h
+++ b/inc/urt_node.h
@@ -83,11 +83,11 @@ typedef struct urt_node
 {
   struct urt_node* next;
   urt_osThread_t* thread;
-  urt_nodeSetupCallback_t* setupcallback;
+  urt_nodeSetupCallback_t setupcallback;
   void* setupparams;
-  urt_nodeLoopCallback_t* loopcallback;
+  urt_nodeLoopCallback_t loopcallback;
   void* loopparams;
-  urt_nodeShutdownCallback_t* shutdowncallback;
+  urt_nodeShutdownCallback_t shutdowncallback;
   void* shutdownparams;
   urt_nodestage_t stage;
   urt_osEventListener_t listener;
diff --git a/src/urt_node.c b/src/urt_node.c
index 8109d02..28fa90a 100644
--- a/src/urt_node.c
+++ b/src/urt_node.c
@@ -37,7 +37,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
 /* LOCAL VARIABLES                                                            */
 /******************************************************************************/
 
-urt_node_t localNode; //TODO:Correct?
+urt_node_t localNode; //TODO
 
 /******************************************************************************/
 /* LOCAL FUNCTIONS                                                            */
@@ -50,24 +50,59 @@ urt_node_t localNode; //TODO:Correct?
  */
 void _main(void* arg)
 {
-    //TODO: Register to core event
-    if (localNode.setupcallback != NULL)
+  urt_osEventMask_t mask;
+  urt_osEventFlags_t flag;   //TODO: flag from core here
+  urtEventRegister(core._evtSource, &localNode.listener, mask, flag);
+  if (localNode.setupcallback != NULL)
+  {
+    mask = localNode.setupcallback(&localNode, arg);
+    if (mask /*TODO: check single bits from mask to find out if bit for core is 1 */)
     {
-        // urt_osEventMask_t mask = localNode.setupcallback(localNode, arg);
-        // TODOs
+        urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK);
     }
-    else
-    {
-        //TODO: act as if setupcallback returned 0xF..F
-    }
-    if (core._status == URT_STATUS_OK)
+  }
+  else
+  {
+     mask = 0xFFFFFFFF;
+  }
+
+  if (core._status == URT_STATUS_OK)
+  {
+    urtCoreSynchronizeNodes(&localNode);
+  }
+
+  bool terminated = false;
+  if (terminated /*TODO: replace with function*/)
+  {
+    urt_osEventMask_t temp = urtEventWait(mask, URT_EVENT_WAIT_ONE, URT_DELAY_INFINITE);
+    if (temp /*TODO: check single bits from mask to find out if bit for core is 1 */)
     {
-        //TODO: Suspend all child threads
-        urtCoreSynchronizeNodes(&localNode);
-        //TODO: Resume all child threads
+      localNode.loopcallback(&localNode, mask, arg);
+      #if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
+        localNode.loops++;
+      #endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */
+      if (mask /*TODO: check single bits from mask to find out if bit for core is 1 */)
+      {
+        urtCoreStopNodes(URT_STATUS_NODE_INVALEVTMASK);
+      }
     }
-    //TODOs
-    return;
+  }
+
+  if (localNode.shutdowncallback)
+  {
+    localNode.shutdowncallback(&localNode, urtCoreGetStatus(), arg);
+  }
+  urtEventUnregister(core._evtSource, &localNode.listener);
+  urt_osThread_t* threadToTerminate = localNode.thread;
+  urt_osThread_t* threadToTerminateChild;
+  while (threadToTerminate != NULL)
+  {
+    threadToTerminateChild = threadToTerminate->children;
+    urtThreadTerminate(&threadToTerminate, URT_THREAD_TERMINATE_REQUEST);
+    threadToTerminate = threadToTerminateChild;
+  }
+  urtThreadExit();
+  return;
 }
 
 /******************************************************************************/
@@ -85,7 +120,6 @@ void _main(void* arg)
  *                         Must be NULL if no setup callback is specified.
  *                         May be NULL if the specified setup callback does not expect parameters.
  * @param[in] loopcallback  Callback function to be executed in a loop.
- *                          Must not be NULL.
  * @param[in] loopparams  Parameters for the loop callback function.
  *                        May be NULL if the specified loop callback does not expect parameters.
  * @param[in] shutdowncallback  Callback function to be executed during shutdown.
@@ -100,13 +134,8 @@ void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback
 {
   urtDebugAssert(node != NULL);
   urtDebugAssert(thread != NULL);
-  //TODO: Setupcallback
   if (setupcallback == NULL)
     urtDebugAssert(setupparams == NULL);
-  urtDebugAssert(loopcallback != NULL);
-  //urtDebugAssert(/*loopparams*/);
-  //urtDebugAssert(shutdowncallback);
-  //urtDebugAssert(shutdownparams);
 
   node->next = NULL;
   node->thread = thread;
