Opened 9 years ago

Closed 9 years ago

#4888 closed bug (fixed)

Document behaviour of throwTo to your own ThreadId

Reported by: batterseapower Owned by: simonmar
Priority: normal Milestone: 7.4.1
Component: Documentation Version: 7.0.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Documentation bug Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

The behaviour of throwTo my_tid could be considered surprising because it seems to work exactly like throw.

Take these two tests:

main = do
    tid <- myThreadId
    
    putStrLn "Self-throw:"
    throwTo tid (ErrorCall "Hello")
    
    putStrLn "Masked self-throw:"
    uninterruptibleMask_ $ throwTo tid (ErrorCall "Hello")

Both of them raise the exception immediately and thus terminate the program. However, given the docs for throwTo and uninterruptibleMask an equally valid interpretation would be for the second test to block forever. Clarifying this might be useful.

(If you try either example in GHCi then no exception is thrown - is that a bug?)

Change History (3)

comment:1 Changed 9 years ago by igloo

Milestone: 7.2.1

comment:2 in reply to:  description Changed 9 years ago by simonmar

Owner: set to simonmar

Replying to batterseapower:

Both of them raise the exception immediately and thus terminate the program. However, given the docs for throwTo and uninterruptibleMask an equally valid interpretation would be for the second test to block forever. Clarifying this might be useful.

Yes, we should add something to the docs.

(If you try either example in GHCi then no exception is thrown - is that a bug?)

Quite possibly.

comment:3 Changed 9 years ago by simonmar

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.