packages feed

thread-local-storage 0.1.0.2 → 0.1.0.3

raw patch · 2 files changed

+42/−5 lines, 2 files

Files

+ Data/TLS/TLS_Sig.hs view
@@ -0,0 +1,37 @@+-- WARNING: This is not a full Haskell module, it is a snippet to #include...++-- | Make a new per-thread variable.  This guarantees that no two+-- threads that execute `getTLS` simultaneosly will receive the same+-- copy of the value.  Generally, to meet this guarantee there must be+-- AT LEAST one copy of the TLS variable for each distinct OS thread+-- that calls `getAll`.  But this is a lower bound, and there may be+-- *more*.  In particular, there could be one per Haskell IO thread+-- rather than per OS thread.+--+-- Thread safe.+mkTLS :: IO a -- ^ Action for creating a single copy of the TLS variable.+      -> IO (TLS a)++-- | Fetch this thread's copy of the TLS variable.  Note that all+-- values returned by this function may be immune to garbage collected+-- until `freeTLS` is called.+--+-- Thread safe.+getTLS :: TLS a -> IO a+++-- | After a TLS-based computation is complete, iterate through all+-- the copies of the TLS variable which were used by all threads.+-- +-- NOT thread safe.+allTLS :: TLS a -> IO [a]+++-- | Like `allTLS`, but apply a computation directly rather than+-- building a list.+forEachTLS_ :: TLS a -> (a -> IO ()) -> IO ()+         +-- | Release all copies of the TLS variable, across all threads.  This+-- does not guarantee the storage will be freed immediately, but it+-- guarantees that the storage can be reclaimed in the future.+freeTLS :: TLS a -> IO ()
thread-local-storage.cabal view
@@ -2,7 +2,7 @@ --  documentation, see http://haskell.org/cabal/users-guide/  name:                thread-local-storage-version:             0.1.0.2+version:             0.1.0.3 synopsis:            Several options for thread-local-storage (TLS) in Haskell. description:    .@@ -31,18 +31,19 @@ -- extra-source-files:   cabal-version:       >=1.10 +extra-source-files:  Data/TLS/TLS_Sig.hs+ library   exposed-modules:     Data.TLS.GHC, Data.TLS.PThread --  Data.TLS.GCC,     other-modules:       Data.TLS.PThread.Internal   other-extensions:    BangPatterns, NamedFieldPuns, CPP-  c-sources: cbits/helpers.c   build-depends:       base >=4.6 && < 5.0,                        containers >=0.5   -- hs-source-dirs:         default-language:    Haskell2010   ghc-options: -O2-   +  c-sources: cbits/helpers.c         benchmark bench-haskell-tls   main-is: Main.hs@@ -58,9 +59,9 @@  test-suite test-tls   main-is: Main.hs+  -- Here we reinclude/rebuild the main sources so we can test the .Internal module:   hs-source-dirs: ./ ./tests/   type: exitcode-stdio-1.0--- build-depends: thread-local-storage   build-depends: base >= 4.6 && < 5.0,                  atomic-primops >= 0.6.0.6   default-language:    Haskell2010@@ -69,4 +70,3 @@   -- DUPLICATED, from above:   build-depends: containers >=0.5   c-sources: cbits/helpers.c       -