killThread and FFI calls

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

killThread and FFI calls

Joel Reymont
Folks,

How does killThread work with FFI calls? What happens at the low  
level when a thread is blocked on an FFI call and received a  
KillThread exception? Does it exit immediately via some GHC magic or  
is the exception caught when the FFI call returns?

        Thanks, Joel

--
http://wagerlabs.com/





_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

RE: killThread and FFI calls

Simon Marlow
On 14 December 2005 14:26, Joel Reymont wrote:

> How does killThread work with FFI calls? What happens at the low
> level when a thread is blocked on an FFI call and received a
> KillThread exception? Does it exit immediately via some GHC magic or
> is the exception caught when the FFI call returns?

The latter.

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: killThread and FFI calls

Joel Reymont

On Dec 14, 2005, at 3:22 PM, Simon Marlow wrote:

> On 14 December 2005 14:26, Joel Reymont wrote:
>
>> How does killThread work with FFI calls? What happens at the low
>> level when a thread is blocked on an FFI call and received a
>> KillThread exception? Does it exit immediately via some GHC magic or
>> is the exception caught when the FFI call returns?
>
> The latter.

Does this change if I kill a thread that's blocked on I/O in a  
threaded runtime?

Does it get cleaned up immediately?

--
http://wagerlabs.com/





_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

RE: killThread and FFI calls

Simon Marlow
In reply to this post by Joel Reymont
On 14 December 2005 15:35, Joel Reymont wrote:

> On Dec 14, 2005, at 3:22 PM, Simon Marlow wrote:
>
>> On 14 December 2005 14:26, Joel Reymont wrote:
>>
>>> How does killThread work with FFI calls? What happens at the low
>>> level when a thread is blocked on an FFI call and received a
>>> KillThread exception? Does it exit immediately via some GHC magic or
>>> is the exception caught when the FFI call returns?
>>
>> The latter.
>
> Does this change if I kill a thread that's blocked on I/O in a
> threaded runtime?
>
> Does it get cleaned up immediately?

A thread blocked on ordinary Handle-based I/O can be killed, because
blocked Handle I/O is implemented using communication with the I/O
manager thread, so it isn't an FFI call under the hood.

Cheers,
        Simon
_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe