Revision a7e54ea4

View differences:

core/src/aos_system.c
779 779
static size_t _numActiveThreads(void)
780 780
{
781 781
  size_t threads = 0;
782

  
783
#if (CH_CFG_USE_REGISTRY == TRUE)
782 784
  thread_t* tp = chRegFirstThread();
783 785
  while (tp) {
784 786
    threads += (tp->state != CH_STATE_FINAL) ? 1 : 0;
785 787
    tp = chRegNextThread(tp);
786 788
  }
789
#elif (CH_CFG_USE_THREADHIERARCHY == TRUE)
790
  enum {
791
    TRAVERSE_DOWN,
792
    TRAVERSE_UP,
793
  } traverse = TRAVERSE_UP;
794
  thread_t* tp = chThdGetSelfX();
795
  // traverse to root thread
796
  while (tp->parent) {
797
    tp = tp->parent;
798
  }
799
  // systematically count all threads
800
  traverse = TRAVERSE_DOWN;
801
  while (tp) {
802
    if (traverse == TRAVERSE_DOWN && tp->children) {
803
      tp = tp->children;
804
    } else {
805
      threads += (tp->state != CH_STATE_FINAL) ? 1 : 0;
806
      if (tp->sibling) {
807
        tp = tp->sibling;
808
        traverse = TRAVERSE_DOWN;
809
      } else {
810
        tp = tp->parent;
811
        traverse = TRAVERSE_UP;
812
      }
813
    }
814
  }
815
#endif
787 816

  
788 817
  return threads;
789 818
}
modules/aos_chconf.h
175 175
 * @note    The default is @p TRUE.
176 176
 */
177 177
#if !defined(CH_CFG_USE_REGISTRY)
178
#define CH_CFG_USE_REGISTRY                 TRUE
178
#define CH_CFG_USE_REGISTRY                 FALSE
179 179
#endif
180 180

  
181 181
/**

Also available in: Unified diff