Revision 22ccef0f src/urt_node.c

View differences:

src/urt_node.c
38 38
/******************************************************************************/
39 39

  
40 40
urt_node_t localNode;
41
static  URT_THREAD_MEMORY(_node_thread, AMIROOS_CFG_SHELL_STACKSIZE);
41
static  URT_THREAD_MEMORY(_node_thread, AMIROOS_CFG_SHELL_STACKSIZE); //TODO: not here
42 42

  
43 43
/******************************************************************************/
44 44
/* LOCAL FUNCTIONS                                                            */
......
94 94
  }
95 95
  urtEventUnregister(urtCoreGetEvtSource(), &localNode.listener);
96 96

  
97

  
98 97
  urt_osThread_t* threadToTerminate = localNode.thread;
99 98
  while (threadToTerminate->children != NULL || threadToTerminate->sibling != NULL)
100 99
  {
......
105 104
  }
106 105
  urtThreadTerminate(&threadToTerminate, URT_THREAD_TERMINATE_REQUEST);
107 106

  
107
  urt_osThread_t* threadToJoin = localNode.thread;
108
  while (threadToJoin->children != NULL || threadToJoin->sibling != NULL)
109
  {
110
    if (threadToJoin->children != NULL)
111
      urtThreadJoin(threadToJoin->children);
112
    if(threadToJoin->sibling != NULL)
113
      urtThreadJoin(threadToJoin->sibling);
114
  }
115
  urtThreadJoin(&threadToJoin);
116

  
108 117
  return;
109 118
}
110 119

  
......
131 140
 *                            Must be NULL if no shutdown callback is specified.
132 141
 *                            May be NULL if the specified shutdown callback does not expect parameters.
133 142
 */
134
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_nodeSetupCallback_t* setupcallback,
143
void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_osThreadPrio_t prio, urt_nodeSetupCallback_t* setupcallback,
135 144
                 void* setupparams, urt_nodeLoopCallback_t* loopcallback, void* loopparams,
136 145
                 urt_nodeShutdownCallback_t* shutdowncallback, void* shutdownparams)
137 146
{
......
141 150
    urtDebugAssert(setupparams == NULL);
142 151

  
143 152
  node->next = NULL;
144
  node->thread = urtThreadInit(_node_thread, sizeof(_node_thread), URT_THREAD_PRIO_NORMAL_MIN, _main, setupparams);
153
  node->thread = urtThreadInit(_node_thread, sizeof(_node_thread), prio, _main, setupparams);
145 154
  node->setupcallback = setupcallback;
146 155
  node->setupparams = setupparams;
147 156
  node->loopcallback = loopcallback;

Also available in: Unified diff