[Haskell-cafe] Need comments on a libusb asynchronous select/poll loop

Bas van Dijk v.dijk.bas at gmail.com
Wed Apr 20 21:27:07 CEST 2011


On 20 April 2011 20:27, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
> On 20 April 2011 18:34, Johan Tibell <johan.tibell at gmail.com> wrote:
>> On Wed, Apr 20, 2011 at 6:11 PM, Bas van Dijk <v.dijk.bas at gmail.com> wrote:
>>> I still need to add appropriate conditions for checking whether the
>>> program is using the threaded RTS. What is the recommended approach
>>> for this?
>>>
>>> I see GHC.Conc.IO uses a dynamic check:
>>>
>>> foreign import ccall unsafe "rtsSupportsBoundThreads" threaded :: Bool
>>>
>>> Is this also available to me as a library author?
>>
>> I think there's a ticket for adding something along the lines of
>>
>>    getSystemEventManager :: IO (Maybe EventManager)
>>
>> If that returns Just em, you're in the threaded RTS and have an EventManager.
>
> Whoever is proposing[1] that is a real genius! ;-)
>
> [1] http://thread.gmane.org/gmane.comp.lang.haskell.libraries/15458/focus=15543
>
> Bas

I have now added the module System.USB.IO that automatically chooses
the asynchronous implementations when supported or the synchronous
otherwise:

https://github.com/basvandijk/usb/blob/async/System/USB/IO.hs

Bas



More information about the Haskell-Cafe mailing list