[ECOS] About threads

Michele Portolan michele.portolan@imag.fr
Wed Jun 27 16:20:00 GMT 2007


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



More information about the Ecos-discuss mailing list