Hi,
thanks for your reply.
On 08/21/2014 11:49 PM, Adam Lackorzynski wrote:
The main issue is that you start 2 threads and then immediately leave the main function, which exits your program and would also destroy all threads. But it does not get so far...
Each thread needs to have a unique UTCB. In this example, you could fix it like this: l4re_env()->first_free_utcb = (l4_addr_t)l4re_env()->first_free_utcb + L4_UTCB_OFFSET; Remember that the size of the initial UTCB area is limited, so this only works a few times (allocating more is possible).
As both threads use the same UTCB this could result in the behavior you're seeing.
I've tried both of your suggestions, but none of them solved the problem. Then I've added
l4re_util_cap_free_um(thread_caps[x]);
at the end of each thread function and now the exception does not appear any more. All output ("Hello World ...") is produced as supposed to be.
I've attached the modified source file for your convenience. Note that the idling of the main thread (lines 109 f.) as well as the manipulation of first_free_utcb (line 99) are _commented out_.
Obviously, both created threads can go on although the main thread has already ended? Why? Is it right that the manipulation of first_free_utcb is necessary only when there is any IPC? In my example, none of the threads is communicating via the message registers.
Best regards, Valentin