Ignore:
Timestamp:
Jan 25, 2018, 1:00:06 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
6e0f4bd
Parents:
81e1f32
Message:

Added doubly-linked list of existing threads

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/concurrency/kernel.c

    r81e1f32 rf7d6bb0  
    609609}
    610610
     611//-----------------------------------------------------------------------------
     612// Debug
     613__cfaabi_dbg_debug_do(
     614        struct {
     615                thread_desc * tail;
     616        } __cfaabi_dbg_thread_list = { NULL };
     617
     618        void __cfaabi_dbg_thread_register( thread_desc * thrd ) {
     619                if( !__cfaabi_dbg_thread_list.tail ) {
     620                        __cfaabi_dbg_thread_list.tail = thrd;
     621                        return;
     622                }
     623                __cfaabi_dbg_thread_list.tail->dbg_next = thrd;
     624                thrd->dbg_prev = __cfaabi_dbg_thread_list.tail;
     625                __cfaabi_dbg_thread_list.tail = thrd;
     626        }
     627
     628        void __cfaabi_dbg_thread_unregister( thread_desc * thrd ) {
     629                thread_desc * prev = thrd->dbg_prev;
     630                thread_desc * next = thrd->dbg_next;
     631
     632                if( next ) { next->dbg_prev = prev; }
     633                else       {
     634                        assert( __cfaabi_dbg_thread_list.tail == thrd );
     635                        __cfaabi_dbg_thread_list.tail = prev;
     636                }
     637
     638                if( prev ) { prev->dbg_next = next; }
     639
     640                thrd->dbg_prev = NULL;
     641                thrd->dbg_next = NULL;
     642        }
     643)
    611644// Local Variables: //
    612645// mode: c //
Note: See TracChangeset for help on using the changeset viewer.