[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 14:44:43 UTC 2010
The following commit has been merged in the master branch:
commit e3c3d97af066cf35bf5719b51c7de0fc6017fdbb
Author: John Goerzen <jgoerzen at complete.org>
Date: Wed Oct 20 02:01:15 2004 +0100
Added Threads.hs
Keywords:
(jgoerzen at complete.org--projects/missingh--head--1.0--patch-71)
diff --git a/ChangeLog b/ChangeLog
index ca81034..4f767f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,21 @@
# arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--1.0
#
+2004-10-19 20:01:15 GMT John Goerzen <jgoerzen at complete.org> patch-71
+
+ Summary:
+ Added Threads.hs
+ Revision:
+ missingh--head--1.0--patch-71
+
+
+ new files:
+ libsrc/MissingH/Threads.hs
+
+ modified files:
+ ChangeLog Setup.description
+
+
2004-10-18 15:02:44 GMT John Goerzen <jgoerzen at complete.org> patch-70
Summary:
diff --git a/Setup.description b/Setup.description
index fbd8705..bcebc5f 100644
--- a/Setup.description
+++ b/Setup.description
@@ -8,7 +8,7 @@ Copyright: Copyright (c) 2004 John Goerzen
Modules: MissingH.IO, MissingH.IO.Binary, MissingH.List,
MissingH.Logging, MissingH.Logging.Handler,
MissingH.Logging.Handler.Simple, MissingH.Logging.Handler.Syslog,
- MissingH.Logging.Logger,
+ MissingH.Logging.Logger, MissingH.Threads
MissingH.Str
HS-Source-Dir: libsrc
Extensions: ExistentialQuantification
diff --git a/libsrc/MissingH/Threads.hs b/libsrc/MissingH/Threads.hs
new file mode 100644
index 0000000..0d24ba3
--- /dev/null
+++ b/libsrc/MissingH/Threads.hs
@@ -0,0 +1,43 @@
+{- arch-tag: Thread utilities main file
+Copyright (C) 2004 John Goerzen <jgoerzen at complete.org>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+-}
+
+{- | This module provides various helpful utilities for dealing with threads.
+
+Written by John Goerzen, jgoerzen\@complete.org
+-}
+
+module MissingH.Threads(-- * I\/O utilities
+ runInThread
+ )
+where
+
+import Control.Concurrent
+
+{- | Takes a IO action and a function. The IO action will be called in a
+separate thread. When it is completed, the specified function is called with
+its result. This is a simple way of doing callbacks. -}
+
+runInThread :: IO a -> (a -> IO b) -> IO ThreadId
+runInThread action callback =
+ let computation :: IO ()
+ computation = do
+ x <- action
+ callback x
+ return ()
+ in
+ forkIO computation
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list