This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
About threads
- From: Michele Portolan <michele dot portolan at imag dot fr>
- To: ecos-discuss at ecos dot sourceware dot org
- Date: Wed, 27 Jun 2007 11:47:40 +0200
- Subject: [ECOS] About threads
A little stupid question about threads:
if I create a thread to execute the function "hello", is the code of the function copied or not?
I better explain mysel: let's say function hello is stored at address 0x00100, and teh code to xcreate the thread is as following:
cyg_thread thread_s[N_THREADS]; /* space for two thread objects */
char stack[N_THREADS][4096]; /* space for two 4K stacks */
cyg_handle_t hello_thread;
....
cyg_thread_create(4, (void (*)(cyg_addrword_t data) )hello, (cyg_addrword_t) 0,
"hello", (void *) stack[0], 4096,
&hello_thread, &thread_s[0]);
When the thread gets executed, does it executes "hello" at 0x00100 or a copy of it stored somewhere in "stack" or "thread_s"?
Thank you very much,
Michele
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss