[Haskell-beginners] forkIO and signal handlers
michael at schmong.org
Fri Sep 9 21:54:21 CEST 2011
forgot to paste in the error message, oops
Couldn't match expected type `IO ()' with actual type `Handler'
In the second argument of `($)', namely
`Catch $ worldHandler world jCount'
In the second argument of `installHandler', namely
`(forkIO $ Catch $ worldHandler world jCount)'
In a stmt of a 'do' expression:
(forkIO $ Catch $ worldHandler world jCount)
Failed, modules loaded:
On Fri, Sep 9, 2011 at 12:53 PM, Michael Litchard <michael at schmong.org> wrote:
> Here's the error message. The problem is clear, not sure what to do
> about it. My broken code should show my intent though.
>> main :: IO ()
>> main = do
>> let world = (newEmptyTMVar :: ProcessState)
>> let jCount = (newEmptyTMVar :: JobCount)
>> installHandler userDefinedSignal1 (forkIO $ Catch $ worldHandler world jCount) Nothing
>> sequence_ $ repeat $ worldCheck
> I'd like to fork in Main. Right now I'm forking in worldHandler. If
> that's what I have to do, then I'll just move on. But I'd like to keep
> the forkIO call in Main if possible.
> On Fri, Sep 9, 2011 at 12:46 PM, Brandon Allbery <allbery.b at gmail.com> wrote:
>> On Fri, Sep 9, 2011 at 15:35, Michael Litchard <michael at schmong.org> wrote:
>>> Thanks for the reply. The problem isn't signal handling, nor is it
>>> using forkIO. It's using both of them together.
>> I think you'll have to provide an example of what you're trying to do and
>> the error message you get.
>> brandon s allbery allbery.b at gmail.com
>> wandering unix systems administrator (available) (412) 475-9364 vm/sms
More information about the Beginners