Ticket #22 (new defect)

Opened 8 years ago

rhs of a::Event <|> b::Event push-lagging more than its lhs

Reported by: ksf Owned by:
Priority: major Milestone:
Version: Keywords:


...as exposed in http://moonpatio.com:8080/fastcgi/hpaste.fcgi/view?id=977 . That one depends on unreleased and discontinued ffi bindings to http://libagar, I can provide the source if necessary.

"more" meaning that even the lhs may lag occasionally, but rarely.

Those Events are produced and consumed by

type Sync :: Clock TimeT

registerEvent :: Sync -> Object -> String -> (AgarEvent -> IO a) -> IO (Event a)
registerEvent cl o s a = do
    (sink, src) <- makeEvent cl
    setEvent o s (\ev -> forkIO (a ev >>= sink) >> return ())
    return src

makeSink :: (a -> Action) -> Event a -> IO ThreadId
makeSink a = forkIO . adaptE . fmap a

that is, event handlers spark threads to sink, and output is shoved into agar in another thread than the one running its event loop (that is sparking the threads).

Note: See TracTickets for help on using tickets.