FFI, signals and exceptions

Simon Marlow marlowsd at gmail.com
Wed Sep 1 06:49:49 EDT 2010


On 01/09/2010 04:22, Edward Z. Yang wrote:

>> Not sure what you mean here: what's a bound FFI call?
>
> Good point: we don’t distinguish between FFI calls that require thread
> local state and which ones don’t: this might be a good thing to allow
> annotating.  If we did know, then we could simply arrange for calls that
> use thread-local state to run on those threads, and we would still be
> able to farm out other FFI calls as necessary.

Alternatively, "interruptible" could mean "does not use thread-local 
state", which makes sense because in order to interrupt a call we have 
to run it with a disposable thread.

I'm not sure about the mechanism for making a call in another OS thread, 
though.  It might be tricky to implement, because you have to arrange to 
communicate the result somehow.

> A technical question about cleaning up task: when I run freeTask on the
> task, I get the following error:
>
> Foo: internal error: invalid closure, info=0xb76fb418
>      (GHC version 6.13.20100823 for i386_unknown_linux)
>
> freeTask is only used from freeTaskManager, so I suppose it’s not quite
> the right thing to do, however, as far as I can tell GHC doesn’t
> have a current story for freeing tasks.  How should I proceed in figuring
> out the cause of this error?

Right, we don't currently free the Task structure until the end, because 
it caches some timing stats.  This might be something we want to clean 
up in the future.  For now, it would be polite to call workerTaskStop() 
at least for the cancelled Task.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list