public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Nick Garnett <nickg@ecoscentric.com>
To: "wyb" <wyb@topsec.com.cn>
Cc: <ecos-discuss@sources.redhat.com>
Subject: Re: [ECOS] exit() and lock()
Date: Fri, 23 Apr 2004 14:13:00 -0000	[thread overview]
Message-ID: <m3pt9yg8lp.fsf@miso.calivar.com> (raw)
In-Reply-To: <019f01c4292c$5bb5d6c0$1a0fa8c0@codingman>

"wyb" <wyb@topsec.com.cn> writes:

> I'm reading the ECOS source code, and confused by Cyg_Thread::exit()
> calling lock() on entry, but not calling unlock() before return
> (Althrough it never return)
> 
> Can anybody help me? thanks

The last thing it does is call Cyg_Scheduler::reschedule(). This
causes the current thread to lose control of the CPU without
decrementing the scheduler lock. 

The scheduler lock is effectively a per-thread value, so when the
context switches to another thread, the lock will be set to that
thread's lock value. It simply doesn't matter that the exited thread
has a non-zero lock value, it will never be rescheduled.

-- 
Nick Garnett                    eCos Kernel Architect
http://www.ecoscentric.com      The eCos and RedBoot experts


-- 
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:[~2004-04-23 12:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-23 13:17 wyb
2004-04-23 14:13 ` Nick Garnett [this message]

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=m3pt9yg8lp.fsf@miso.calivar.com \
    --to=nickg@ecoscentric.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=wyb@topsec.com.cn \
    /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).