FFI, signals and exceptions

Simon Marlow marlowsd at gmail.com
Thu Aug 26 04:02:00 EDT 2010


On 26/08/2010 06:57, Edward Z. Yang wrote:
> Excerpts from Edward Z. Yang's message of Thu Aug 26 01:22:22 -0400 2010:
>> I spent some time looking at the code, and I've been having a difficult
>> time finding the thread ID of the worker thread that is performing the
>> safe FFI call.  The target TSO is the suspended Haskell thread, which
>> afaict is distinct from the worker thread that is actually doing the FFI
>> call, so the obvious Tasks from bound/cap seem to be the wrong ones.
>> Do I have to walk all_tasks to find the one that's running the call I care
>> about?
>
> Of course, immediately after I send this message, my debug build finishes
> and I find target->bound->task is the one I care about. :-)

target->bound->task is only present for a bound thread, for an ordinary 
unbound thread I think there is currently no (easy) way to get from the 
TSO to the Task.  The InCall, which points to both the TSO and the Task, 
is stored on the cap->suspended_ccalls list, and you could find the 
right one by walking that list.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list