newKernelEventReader :: Sys (TChan KernelEvent)
newKernelEventReader = do
   h  <- createKernelEventSocket
   ch <- newBroadcastTChanIO
   let
      go = forever $ do
               threadWaitRead h
               ev <- receiveKernelEvent h
               atomically $ writeTChan ch ev

   sysFork "Kernel sysfs event reader" go
   return ch


-- | Get device handle by name (i.e., sysfs path)
newKernelEventReader :: Sys (TChan KernelEvent)
newKernelEventReader = do
   h  <- createKernelEventSocket
   ch <- newBroadcastTChanIO
   let
      go = forever $ do
               threadWaitRead h
               ev <- receiveKernelEvent h
               atomically $ writeTChan ch ev

   sysFork "Kernel sysfs event reader" go
   return ch


-- | Get device handle by name (i.e., sysfs path)
newKernelEventReader = do
   h  <- createKernelEventSocket
   ch <- newBroadcastTChanIO
   let
      go = forever $ do
               threadWaitRead h
               ev <- receiveKernelEvent h
               atomically $ writeTChan ch ev

   sysFork "Kernel sysfs event reader" go
   return ch


-- | Get device handle by name (i.e., sysfs path)