Hi Martin,

> I have a question about 'static inline void
> thread_switch_to(Native_thread_id tid)'. This function shall yield to a
> given thread, but what is the expected behavior if the targeted thread
> exists and is started but also paused?

normally, this function is called by the lock implementation to help a
lock-applying thread to enter the kernel (via 'thread_stop_myself') when
the lock is contended. In the normal case, the thread needs no help for
that. But very rarely, the kernel may preempt the thread just before it
was able to call 'thread_stop_myself' (see the longish prose at line 122
in 'base/lock/lock.cc') and pass control to the lock owner, which
releases the lock.


https://github.com/genodelabs/genode/blob/master/base/src/base/lock/lock.cc

If the thread is already blocked, there is nothing to do. I'd suggest to
just return to the user land.

Cheers
Norman

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Genode-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/genode-main

Reply via email to