> Thanks, now I understand. The main question was why threadcreate asks
> for function pointer and can't just leave me in my function like rfork.
> So it is because we should move local variables out of scope as they
> are no more valid cause we have a new completely clear stack.
yes.

> But when it is better to use rfork with shared memory and when
> libthread?
depends. but in the majority of cases you want to use libthread because
it also gives you synchronization primitives like channels and has
co-routines called threads wich run cooperatively in a real system
proc.

but nobody forces you to use libthread. you can just use system primitives
like rendezvous, qlocks, pipes and shared memory with rfork.

--
cinap


Reply via email to