Revision 1ca1aee9 core/src/aos_thread.c

View differences:

core/src/aos_thread.c
135 135
  aosDbgCheck(thread != NULL);
136 136

  
137 137
#if (CH_CFG_USE_REGISTRY == TRUE)
138

  
138 139
  return chRegNextThread(thread);
140

  
139 141
#elif (CH_CFG_USE_THREADHIERARCHY == TRUE)
142

  
143
#if (CH_CFG_NO_IDLE_THREAD == FALSE)
144
  // idle thread is last (see below)
145
  if (thread == chSysGetIdleThreadX()) {
146
    return NULL;
147
  }
148
#endif /* (CH_CFG_NO_IDLE_THREAD == FALSE) */
149

  
150
  // iterate through threads in a depth-first approach
140 151
  if (thread->children != NULL) {
141 152
    return thread->children;
142 153
  } else {
143 154
    while (thread != NULL && thread->sibling == NULL) {
144 155
      thread = thread->parent;
145 156
    }
157
#if (CH_CFG_NO_IDLE_THREAD == FALSE)
158
    // append idle thread explicitely as it is not part of the hierarchy tree
159
    return (thread != NULL) ? thread->sibling : chSysGetIdleThreadX();
160
#else /* (CH_CFG_NO_IDLE_THREAD == FALSE) */
146 161
    return (thread != NULL) ? thread->sibling : NULL;
162
#endif /* (CH_CFG_NO_IDLE_THREAD == FALSE) */
147 163
  }
148
#endif
164

  
165
#endif /* (CH_CFG_USE_THREADHIERARCHY == TRUE) */
149 166
}
150 167

  
151 168
#endif /* (CH_CFG_USE_REGISTRY == TRUE) || (CH_CFG_USE_THREADHIERARCHY == TRUE) */

Also available in: Unified diff