Hello Rumen,
as you discovered, the thread capability is merely a low-level
mechanism. It should normally not be used directly.
> Is there a function similar to the one above that will work for Linux?
To kill a thread, destruct the 'Thread` object. Without precautions,
however, this brutal method may still have unwelcome side effects as the
killed thread may be in an intermediate state like holding a lock. A
thread killing itself is a no-go because its execution might crease
mid-way during its destruction, provoking inconsistencies like a missing
release of the thread's stack.
It is best to have a clear notion of ownership. The one thread who
creates another thread should be the one destroying it.
For the destruction, it is advisable to implement a clean wind-down
procedure (e.g., the to-be-killed thread signals its owner that it is
ready to be destructed) and let the owner call 'Thread::join' before
destructing the 'Thread' object.
Cheers
Norman
--
Dr.-Ing. Norman Feske
Genode Labs
https://www.genode-labs.com · https://genode.org
Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
_______________________________________________
users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Archived at
https://lists.genode.org/mailman3/hyperkitty/list/[email protected]/message/XIV3J5G3KJBHSSBDKAL6Q6IETJMAEAP3/