This is the mail archive of the mailing list for the eCos project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]


Why does add_to_list() search to see if the
thread is already on the thread_list? Wouldn't
that be a symptom of a bug?

Using #if to remove the search as shown below doesn't appear
to cause any problems.

inline void
Cyg_Thread::add_to_list( void )
    // Add thread to housekeeping list

    if( thread_list == 0 ) {
        list_next = this;
	list_prev = this;
    else {
#if 0
        Cyg_Thread *prev = thread_list;
       /* As far as I can tell, add_to_list is only called from
	* the contstructor, so it should not be necessary to check
	* see if this is already in the list.
        do {
            if ( this == prev )
                break; // found it already!
            prev = prev->list_next;
        } while ( prev != thread_list );

        if ( this != prev )
            // insert it in the list:
            list_next = thread_list;
	    list_prev = thread_list->list_prev;
	    thread_list->list_prev->list_next = this;
	    thread_list->list_prev = this;
    thread_list = this;


Chris Morrow	YottaYotta Inc. email:
phone: (780) 989 6814 web:	http:  //

Before posting, please read the FAQ:
and search the list archive:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]