RE: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-12 Thread Simon Marlow
On 11 December 2005 17:19, Joel Reymont wrote: > Nothing like answering your own questions... > > There's no deadlock information for the threaded version of the > runtime so I would not have deadlock information if I were to compile > with -threaded. This doesn't really help you right now, but

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-12 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Mon, 12 Dec 2005 09:00:18 + The app is multi-threaded but uses lightweight threads (un

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-12 Thread Joel Reymont
The app is multi-threaded but uses lightweight threads (unbound). On Dec 12, 2005, at 4:24 AM, Branimir Maksimovic wrote: If your app is single threaded you should be ok. But then nothing is executed concurrently? why locking at all then? You wouldn;t have problems with deadlocks and signals

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-12 Thread Joel Reymont
No way. Thanks for the suggestion, though ;-). On Dec 12, 2005, at 7:48 AM, Tomasz Zielonka wrote: As a fast and dirty solution, I propose using MVar [Dynamic]. -- http://wagerlabs.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org htt

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Tomasz Zielonka
On Sun, Dec 11, 2005 at 10:37:12PM +, Joel Reymont wrote: > Oh, right. It does not apply in my case, though, so I thought it was > safe. > > I'm not sure what the proper Haskell wording is to explain but it > seems like the type system catches if a user of the library tries to > use two

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: "Branimir Maksimovic" <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Mon, 12 Dec 2005 02:28:54 + My client _is_ single-threaded, I do not use

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
My client _is_ single-threaded, I do not use bound (OS) threads at all. Does this shed any light on why my OpenSSL stuff is working as well as my signal handler? ;-) On Dec 12, 2005, at 12:21 AM, Branimir Maksimovic wrote: In single threaded client you can handle ^C if you like in signal

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Glynn Clements
Joel Reymont wrote: > > This should be enough reason to scan for keyboard events instead. > > There is no guarantee that SIGINT would be sent only by keyboard. > > import System.Posix.Signals > > main = > do installHandler sigINT Ignore Nothing > x <- getChar > if x == '\E

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 23:52:19 + On Dec 11, 2005, at 10:02 PM, Branimir Maksimovic wrote:

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 23:31:44 + Allright, I _am_ convinced. How do I ready ^C from the keyb

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
On Dec 11, 2005, at 10:02 PM, Branimir Maksimovic wrote: Problem with mt programs is that they just appear to work but in havy load situation those errors show once a while. My loads are pretty heavy. Did not see any problems with SSL yet. This should be enough reason to scan for keyboar

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
^C seems to be '\ETX' so ignoring SIGINT and using getChar should probably do it. On Dec 11, 2005, at 11:31 PM, Joel Reymont wrote: Allright, I _am_ convinced. How do I ready ^C from the keyboard??? On Dec 11, 2005, at 10:02 PM, Branimir Maksimovic wrote: This should be enough reason to sc

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Allright, I _am_ convinced. How do I ready ^C from the keyboard??? On Dec 11, 2005, at 10:02 PM, Branimir Maksimovic wrote: This should be enough reason to scan for keyboard events instead. There is no guarantee that SIGINT would be sent only by keyboard. -- http://wagerlabs.com/ __

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Oh, right. It does not apply in my case, though, so I thought it was safe. I'm not sure what the proper Haskell wording is to explain but it seems like the type system catches if a user of the library tries to use two different a's (Child a) and complains. Exactly what I need as access to

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: "Branimir Maksimovic" <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 19:09:20 + What I do works so I don't see any reason

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Tomasz Zielonka
On Sun, Dec 11, 2005 at 08:37:06PM +, Joel Reymont wrote: > Would you care to elaborate? This has not caused any problems for me > so far but this is probably due to my usage. This is a know danger of using unsafePerformIO and one reason for "unsafe" in its name. >From http://www.cse.unsw.e

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Would you care to elaborate? This has not caused any problems for me so far but this is probably due to my usage. On Dec 11, 2005, at 8:09 PM, Tomasz Zielonka wrote: On Sun, Dec 11, 2005 at 07:09:20PM +, Joel Reymont wrote: {-# NOINLINE children #-} children :: MVar [Child a] children =

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Tomasz Zielonka
On Sun, Dec 11, 2005 at 07:09:20PM +, Joel Reymont wrote: > {-# NOINLINE children #-} > children :: MVar [Child a] > children = unsafePerformIO $ newMVar [] This is asking for disaster. children shouldn't have a polymorphic type! Best regards Tomasz -- I am searching for a programmer who is

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
What I do works so I don't see any reason to do it otherwise. Now, it might work by luck and chance, by some ghc magic or otherwise, but it does work and causes me no problems. Not when I press ^C and everything shuts down cleanly. My issues are 1) A phantom sigINT that gets sent to me out of no

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: "Branimir Maksimovic" <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 18:25:47 + Understood. But I'm printing things in

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Understood. But I'm printing things in the signal handler to show that it was triggered. And I trigger it when ^C is pressed (well, one more signal): initSnippets :: IO () initSnippets = do initSSL installHandler sigPIPE Ignore Nothing flip mapM_ [sigTERM, sigINT] $ \sig ->

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
details . Deadlocks can be caused by other things, not neccessarily signals. Greetings, Bane. From: "Branimir Maksimovic" <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 D

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Branimir Maksimovic <[EMAIL PROTECTED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 16:56:23 + On Dec 11, 2005, at 4:50 PM, Branimir Maksimovic wrote:

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Would there be any advantage in doing this? There's no deadlock info produced for a debug threaded runtime, for example. Not according to ghc/rts/Schedule.c. Of course I could print the capabilities of the main thread (TSO structure) and see what it's blocked on, etc. but I could do that

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
The second one is the threaded and profiled runtime. On Dec 11, 2005, at 5:14 PM, Branimir Maksimovic wrote: I've got two versions: HSrts_thr and HSrts_thr_p I don't know what's second for? but there is only one with debug in it's name. So I'm not much of a help here. -- http://wagerlabs.com/

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Nothing like answering your own questions... There's no deadlock information for the threaded version of the runtime so I would not have deadlock information if I were to compile with -threaded. On Dec 11, 2005, at 5:00 PM, Joel Reymont wrote: Linking ... /usr/bin/ld: can't locate file fo

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
TED]> CC: haskell-cafe@haskell.org Subject: Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 17:00:50 + Linking ... /usr/bin/ld: can't locate file for: -lHSrts_thr_debug collect2: ld returned 1 exit status How do I get a threaded+debug runtime? On Dec

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
Linking ... /usr/bin/ld: can't locate file for: -lHSrts_thr_debug collect2: ld returned 1 exit status How do I get a threaded+debug runtime? On Dec 11, 2005, at 4:50 PM, Branimir Maksimovic wrote: Strange is that you are using threaded run time (I guess ) but this function is defined only for

Re: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Joel Reymont
On Dec 11, 2005, at 4:50 PM, Branimir Maksimovic wrote: This is not signal, it is result from call to pause() . [...] you have to look elsewhere as this is normal behavior. You are saying that triggering my ^C handler randomly is normal behavior? I understand why it goes to wait for signals

RE: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX

2005-12-11 Thread Branimir Maksimovic
From: Joel Reymont <[EMAIL PROTECTED]> To: Haskell Cafe Subject: [Haskell-cafe] Re: syscall, sigpause and EINTR on Mac OSX Date: Sun, 11 Dec 2005 16:33:36 + I looked at the scheduler source code and it appears that GHC goes to wait for signals when a deadlock is detected and there's no