#4456: Missing atexit symbol
-------------------------------+--------------------------------------------
    Reporter:  mitar           |        Owner:              
        Type:  bug             |       Status:  new         
    Priority:  normal          |    Milestone:  7.0.2       
   Component:  GHCi            |      Version:  6.12.3      
    Keywords:                  |     Testcase:              
   Blockedby:                  |   Difficulty:              
          Os:  Linux           |     Blocking:              
Architecture:  x86_64 (amd64)  |      Failure:  None/Unknown
-------------------------------+--------------------------------------------

Comment(by mitar):

 OK. Later on I found more. In FFI code (when compiled with GHC) you should
 really not use `atexit` (if you do not use some mutex or something). I was
 getting segment faults because I used `atexit` to cleanup. But at the same
 time I called cleanup from Haskell when program was exiting. The result
 was (because I didn't have any special mutex around cleanup code) that
 cleanup was getting called twice (and it seems even at the same time).
 Probably because I called cleanup from one Haskell thread and `atexit` was
 called from main program thread. So there is some interaction going on.
 Hm, now that I think I see that the problem was probably because I didn't
 wait for all threads to finish (one of them was doing FFI cleanup) before
 main thread exited. So this is probably why it happened that that cleanup
 function was called twice.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4456#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to