This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: priority of main thread
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