public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: "Richard Rauch" <rrauch@itrgmbh.de>
To: <ecos-discuss@ecos.sourceware.org>
Subject: [ECOS] Found problem in Thread class implementation
Date: Thu, 23 May 2013 10:49:00 -0000	[thread overview]
Message-ID: <001701ce57a3$3e98cc50$bbca64f0$@itrgmbh.de> (raw)

Hi,

maybe I found a problem in schedulers code....

For debugging purposes I enabled some options:

- CYGVAR_KERNEL_THREADS_LIST
- CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT

On application startup some threads should be created, but I am running in
an exception. The reason of exception is located here:

inline void
Cyg_Thread::add_to_list( void )
{
    // Add thread to housekeeping list
    Cyg_Scheduler::lock();

    if( thread_list == 0 )
        list_next = this;
    else {
        Cyg_Thread *prev = thread_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_next;
            thread_list->list_next = this;
        }
    }
    thread_list = this;

    Cyg_Scheduler::unlock();
}

In this loop prev becomes NULL, but there is no test on NULL, so the
statement <NULL>->list_next causes an exception!
Should there a test on NULL pointer only? I do not understand the reason for
while loop condition: while (prev != thread_list). Should I compare to NULL
here or is it more complex?


Thanks 

Richard

ITR GmbH
web:     http://www.itrgmbh.com
email:   info@itrgmbh.com


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

             reply	other threads:[~2013-05-23 10:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 10:49 Richard Rauch [this message]
2013-05-23 14:39 ` Nick Garnett
2013-05-24  5:13   ` AW: " Richard Rauch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001701ce57a3$3e98cc50$bbca64f0$@itrgmbh.de' \
    --to=rrauch@itrgmbh.de \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).