d-bus 0.1.3 → 0.1.3.1
raw patch · 3 files changed
+23/−12 lines, 3 files
Files
- d-bus.cabal +1/−1
- src/DBus/MainLoop.hs +11/−11
- src/DBus/Signal.hs +11/−0
d-bus.cabal view
@@ -1,5 +1,5 @@ name: d-bus-version: 0.1.3+version: 0.1.3.1 synopsis: Permissively licensed D-Bus client library description: This library uses modern extensions to the Haskell type system (including GADTs, DataKinds and TypeFamilies) and the
src/DBus/MainLoop.hs view
@@ -276,17 +276,17 @@ aliveRef <- newTVarIO True weakAliveRef <- mkWeakPtr aliveRef Nothing let kill = do- mbRef <- deRefWeak weakAliveRef- case mbRef of- Nothing -> return ()- Just ref -> atomically $ writeTVar ref False- hClose h- slots <- atomically $ do sls <- readTVar answerSlots- writeTVar answerSlots Map.empty- return sls- atomically $ writeTVar signalSlots []- atomically $ forM_ (Map.elems slots) $ \s -> s . Left $- [DBV $ DBVString "Connection Closed"]+ mbRef <- deRefWeak weakAliveRef+ case mbRef of+ Nothing -> return ()+ Just ref -> atomically $ writeTVar ref False+ hClose h+ slots <- atomically $ do sls <- readTVar answerSlots+ writeTVar answerSlots Map.empty+ return sls+ atomically $ writeTVar signalSlots []+ atomically $ forM_ (Map.elems slots) $ \s -> s . Left $+ [DBV $ DBVString "Connection Closed"] mfix $ \conn' -> do debugM "DBus" $ "Forking" handlerThread <- forkIO $ Ex.catch (do
src/DBus/Signal.hs view
@@ -210,6 +210,17 @@ addSignalHandler match mempty (atomically . writeTChan signalChan) dbc return signalChan +signalChan' :: Representable a =>+ SignalDescription (FlattenRepType (RepType a))+ -> Maybe Text+ -> MatchRule+ -> DBusConnection+ -> IO (TChan a)+signalChan' desc sender rules con = do+ signalChan <- newTChanIO+ handleSignal desc sender rules (atomically . writeTChan signalChan) con+ return signalChan+ createSignal desc x = Signal{ signalPath = signalDPath desc , signalInterface = signalDInterface desc , signalMember = signalDMember desc