Hi Jan,

On 06/03/2015 01:38 AM, Jan Mareš wrote:
> I had a discussion here once with Jakub J about fibrils and threads. I
> was told that I can use threads with fibrils, but only as execution
> containers. How would I do it then? What I tried is creating new thread
> and right in the entry point of the thread I call
> fibril_switch(FIBRIL_FROM_DEAD). This seems to work, but when I test it
> more, I run into strange things starting with occasional page faults and
> ending with kernel panic, when trying to kill a process that only
> started 2 threads (1 call to thread_create), but is reporting 3 in the
> top application.

Hm, I once tried that with VFS and FIBRIL_TO_MANAGER and it seemed to
work well. But there may be some bugs as this is definitely not a well
tested usecase. Would you mind sharing some steps to reproduce / a more
detailed bug report?

> If I have more threads running some fibrils are sync primitives from
> fibril_synch still good enough to protect shared memory? I'm asking to
> rule out option that I'm doing something fundamentally wrong. Because if
> this is valid way to use threads and fibrils I probably have a race
> condition in my code that I can't find.

The fibril synchronization primitives use the async_futex in order to be
thread-safe. So this should be ok.

Jakub

_______________________________________________
HelenOS-devel mailing list
[email protected]
http://lists.modry.cz/listinfo/helenos-devel

Reply via email to