public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Jonathan Larmour <jifl@eCosCentric.com>
To: Gary Thomas <gary@mlbassoc.com>
Cc: Bob.Brusa@gmail.com,
	  eCos discussion <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] priority of main thread
Date: Fri, 21 Nov 2008 18:07:00 -0000	[thread overview]
Message-ID: <4926CC5B.2000102@eCosCentric.com> (raw)
In-Reply-To: <49258AC6.8060609@mlbassoc.com>

Gary Thomas wrote:
> Robert Brusa wrote:
>> On Thu, 20 Nov 2008 16:34:18 +0100, Gary Thomas <gary@mlbassoc.com> wrote:
>>
>>> How is main() getting started?  Since you've overridden the
>>> default cyg_user_start() [which normally starts the main thread],
>>> it's not clear to me how main() even runs.
>>>
>> If there is anywhere a main in a project, it gets started - but after
>> cyg_user_start. That's what I have read in the manual and somewhere I
>> have read that a main is required when one uses some (which?) standard
>> libraries that need initialisation. Because I use math and other
>> libraries, I decided to have a main in my code. May be its not
>> necessary, but it should do no harm (I hope).
> 
> Actually, main() is started by cyg_user_startup().  Look at
>   .../language/c/libc/startup/current/src/cstartup.cxx

Actually it only gets started from cyg_user_start() if the user enables
CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT. But that is only the default if there
is no eCos kernel at all.

Otherwise (in the more normal case), it is created and started from a
static constructor. So overriding cyg_user_start() makes no difference.

To answer the poster's question, the priority is set with the
CYGNUM_LIBC_MAIN_THREAD_PRIORITY configuration option in the
CYGPKG_LIBC_STARTUP ("ISO environment startup/termination") package.

Jifl
-- 
eCosCentric Limited      http://www.eCosCentric.com/     The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.       Tel: +44 1223 245571
Registered in England and Wales: Reg No 4422071.
------["Si fractum non sit, noli id reficere"]------       Opinions==mine

-- 
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:[~2008-11-21 14:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-20 15:34 Robert Brusa
2008-11-20 16:02 ` Gary Thomas
2008-11-20 16:06   ` Robert Brusa
2008-11-20 18:42     ` Gary Thomas
2008-11-21 18:07       ` Jonathan Larmour [this message]
2008-11-24 11:06         ` Robert Brusa
2008-11-24 11:53           ` Robert Brusa
2008-11-24 12:57             ` Jonathan Larmour
2008-11-20 16:03 ` Andrew Lunn

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=4926CC5B.2000102@eCosCentric.com \
    --to=jifl@ecoscentric.com \
    --cc=Bob.Brusa@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=gary@mlbassoc.com \
    /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).