Passing data to a thread

Valentin Hauner <[email protected]>
Newsgroups gmane.comp.micro-kernel.l4.devel
Message-ID <[email protected]>
Hi,

I'm trying to pass some data to a newly created thread.
Since l4_thread_ex_regs only accepts an instruction pointer, but no data
pointer, it seems impossible to me to use a parameterized function such as:
> thread1_func(void *data) { /* Read the data ... */ }

So far, my efforts are:

1. I've tried filling the stack allocated to each newly created thread with
> thread_stack = malloc(8 << 10);
> thread_stack[0] = my_data;
but then I'm not able to pop the data from the stack in thread1_func.

2. I've tried using IPC: The main thread which is creating the new
threads sends the data to the destination thread. I'm using l4_ipc_send
in the main thread and l4_ipc_receive in thread1_func just like in your
utcb-ipc example. It works great, but unfortunately the call of
l4_ipc_send leads to an _immediate_ execution of thread1_func (timeouts:
L4_IPC_NEVER), so my scheduling policy is not respected.

So how can I pass data to a thread in a way that is equivalent to
passing arguments to functions?

Best regards,
Valentin
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.