1. 14 Apr, 2005 1 commit
  2. 21 Jan, 2005 1 commit
    • sof's avatar
      [project @ 2005-01-21 19:58:51 by sof] · c7fd6356
      sof authored
      win32 only:
        Tidy up delivery and handling of console events by having the low-level
        console event handler signal the RTS thread blocked waiting for I/O.
  3. 17 Nov, 2004 1 commit
    • sof's avatar
      [project @ 2004-11-17 19:07:38 by sof] · 900ca61d
      sof authored
      Expose Win32 console event handling to the user.
      Added RTS support for registering and delivering console events quite
      a while ago (rts/win32/ConsoleHandler.c), but got bored with it before
      completing the job. Here's the concluding commit; it does the following:
      - new module, base/GHC/ConsoleHandler.hs which supports registering of
        console event handlers (the null module on plats other than mingw).
      - special handling of aborted async read()s on 'standard input' in
        rts/win32/IOManager.c (together with GHC.Conc.asyncRead). See comments
        in that IOManager.c as to why this is needed.
        [ Any other code that performs blocking I/O on 'standard input' will
          need to be tweaked too to be console event handler/signal friendly.]
      - for now, disable the delivery of 'close' events (see
        rts/win32/ConsoleHandler.c:generic_handler() for reasons why)
      Feel free to hoik GHC/ConsoleHandler.hs around the lib hierarchy to wherever
      is considered more fitting. Unifying functionality between System.Posix.Signals
      and GHC.ConsoleHandler is one (obvious) thing to do.
      -- Demonstrating GHC.ConsoleHandler use; win32 only
      module Main(main) where
      import GHC.ConsoleHandler
      import System.IO  (hFlush, stdout)
      import GHC.Conc   (threadDelay)
      main :: IO ()
      main = do
        installHandler (Catch (\ _ -> putStrLn "Caught console event; ignoring" >> hFlush stdout))
        loop = do
          threadDelay 100000
          ls <- getLine
          putStrLn ls
  4. 14 Sep, 2004 1 commit
  5. 19 Aug, 2004 1 commit
  6. 15 Mar, 2004 1 commit
  7. 26 Feb, 2004 1 commit
  8. 25 Feb, 2004 1 commit
    • simonmar's avatar
      [project @ 2004-02-25 16:18:00 by simonmar] · e15f63f3
      simonmar authored
      ShutdownIOManager: don't free the IOManagerState, because the worker
      threads haven't necessarily died yet and might reference it again.
      Apparently fixes a strange bug: I have a Haskell program which on
      Windows causes the shell to exit after I run it.  I don't know what
      the real cause of this is, but this is a clear bug and fixing it stops
      the shell from exiting.
  9. 18 Dec, 2003 2 commits
    • simonmar's avatar
      [project @ 2003-12-18 13:29:23 by simonmar] · e807565a
      simonmar authored
      Optimisation in awaitEvent(): reset the abandonRequestWait() signal if
      it isn't needed (compensates for not using PulseEvent() in
      abandonRequestWait(), see AsyncIO.c for details).
      Code cleanup in awaitEvent(): don't test the various exit conditions twice.
    • simonmar's avatar
      [project @ 2003-12-18 13:27:27 by simonmar] · 50ebfb02
      simonmar authored
      Fix some threaded RTS bugs:
       - in awaitRequests(), it was possible to return immediately even
         though wait was set to rtsTrue.  This lead to a busy wait loop,
         so I've disabled that case (see code for details).
       - using PulseEvent in abandonRequestWait() wasn't the right thing,
         because it exposed a race condition.  Again, see the comment in
         the code for details.
  10. 15 Dec, 2003 1 commit
  11. 21 Oct, 2003 1 commit
  12. 20 Oct, 2003 1 commit
    • sof's avatar
      [project @ 2003-10-20 17:15:27 by sof] · d0c6e4ec
      sof authored
      Console event handling support (i.e., Haskell-side support for SIGINT under win32).
      win32/ConsoleHandler.h implements the Signals.h API. No library support
      for installing user event handlers included in this commit.
  13. 15 Sep, 2003 1 commit
    • sof's avatar
      [project @ 2003-09-15 20:39:38 by sof] · ce42f19f
      sof authored
      factor out code that handles depositing of work items on the
        thread pool's request queue.
      - when it looks as if a new worker thread needs to be created, give
        up our quantum first in the hope that this might at the last minute
        turn up more idle worker threads.
      - add comment re: trimming pool size.
      Merged to STABLE eventually; I may continue tinkering with this code
      some more over the next day or two.
  14. 12 Sep, 2003 3 commits
    • sof's avatar
      [project @ 2003-09-12 16:26:05 by sof] · fe41b2dc
      sof authored
      - Sleep()'s resolution is millisecs, not microsecs.
      - adopt a more agressive policy for augmenting the thread pool
        to handle incoming requests (see code comments for details.)
        The previous policy ran the risk of starvation in rare (and hard
        to reproduce) cases, as spotted after having chased a bug
        for two days.
      Merge to STABLE
    • sof's avatar
      [project @ 2003-09-12 16:16:43 by sof] · 9fc59c6e
      sof authored
      - awaitRequests() comments
      - code reformatting
      Merge to STABLE
    • sof's avatar
      [project @ 2003-09-12 14:42:36 by sof] · 546e865b
      sof authored
      comment wibble
  15. 11 Sep, 2003 2 commits
    • sof's avatar
      [project @ 2003-09-11 00:58:02 by sof] · 384a584a
      sof authored
      Fix race condition re: WorkItems and SubmitWork().
      It is unsafe to access a WorkItem after it has been queued, since
      a worker thread may have already serviced (and freed) it.
      Hence, return request IDs without looking at the WorkItem.
      If desired, this one could be merged to STABLE.
    • sof's avatar
      [project @ 2003-09-11 00:39:04 by sof] · 3565204c
      sof authored
      awaitRequests(): canonicalize removal of thread from blocked_queue
  16. 16 Jul, 2003 1 commit
    • sof's avatar
      [project @ 2003-07-16 17:40:38 by sof] · 788897b6
      sof authored
      - change prototype of async proc calls to
            typedef int (*DoProcProc)(void *param);
        i.e., have the proc return a result. Turned out that almost all
        uses of the primop ended up encoding a result via their 'param'.
      - when adding new I/O requests, shorten the time the IOManager
        lock is held. Helps to keep down the size of the thread pool.
  17. 12 Jul, 2003 1 commit
  18. 03 Jul, 2003 1 commit
    • sof's avatar
      [project @ 2003-07-03 15:14:56 by sof] · 18340925
      sof authored
      New primop (mingw only),
        asyncDoProc# :: Addr# -> Addr# -> State# RealWorld-> (# State# RealWorld, Int#, Int# #)
      which lets a Haskell thread hand off a pointer to external code (1st arg) for
      asynchronous execution by the RTS worker thread pool. Second arg is data passed
      in to the asynchronous routine. The routine is _not_ permitted to re-enter
      the RTS as part of its execution.
  19. 08 Apr, 2003 1 commit
  20. 29 Mar, 2003 1 commit
  21. 04 Mar, 2003 1 commit
    • sof's avatar
      [project @ 2003-03-04 01:29:25 by sof] · 81cbad07
      sof authored
        pass in non-NULL pointer to _beginthreadex()'s outgoing thread ID arg.
        Needed to work with Win9x's impl of CreateThread().
  22. 22 Feb, 2003 1 commit
    • sof's avatar
      [project @ 2003-02-22 04:51:50 by sof] · 557947d3
      sof authored
      Clean up code&interfaces that deals with timers and asynchrony:
      - Timer.{c,h} now defines the platform-independent interface
        to the timing services needed by the RTS. Itimer.{c,h} +
        win32/Ticker.{c,h} defines the OS-specific services that
        creates/destroys a timer.
      - For win32 plats, drop the long-standing use of the 'multimedia'
        API timers and implement the ticking service ourselves. Simpler
        and more flexible.
      - Select.c is now solely for platforms that use select() to handle
        non-blocking I/O & thread delays. win32/AwaitEvent.c provides
        the same API on the Win32 side.
      - support threadDelay on win32 platforms via worker threads.
      Not yet compiled up on non-win32 platforms; will do once checked in.
  23. 21 Feb, 2003 1 commit
    • sof's avatar
      [project @ 2003-02-21 05:34:12 by sof] · 5b4f5a6a
      sof authored
      Asynchronous / non-blocking I/O for Win32 platforms.
      This commit introduces a Concurrent Haskell friendly view of I/O on
      Win32 platforms. Through the use of a pool of worker Win32 threads, CH
      threads may issue asynchronous I/O requests without blocking the
      progress of other CH threads. The issuing CH thread is blocked until
      the request has been serviced though.
      GHC.Conc exports the primops that take care of issuing the
      asynchronous I/O requests, which the IO implementation now takes
      advantage of. By default, all Handles are non-blocking/asynchronous,
      but should performance become an issue, having a per-Handle flag for
      turning off non-blocking could easily be imagined&introduced.
      [Incidentally, this thread pool-based implementation could easily be
      extended to also allow Haskell code to delegate the execution of
      arbitrary pieces of (potentially blocking) external code to another OS
      thread. Given how relatively gnarly the locking story has turned out
      to be with the 'threaded' RTS, that may not be such a bad idea.]