Gauche Devlog

< Gc update | Consumers for generators >

2012/02/08

Threads, build process, lazy sequences

Haven't updated this blog for a while (again). Here's a quick progress report.

Windows threads

On Windows/MinGW, threads are finally supported. It uses Windows thread (not pthread-win32.) Configure with --enable-threads=win32 on MinGW&MSYS environment.

  ./configure --enable-threads=win32

By 0.9.2, you might have checked the availability of threads by gauche.sys.pthreads feature identifier in cond-expand. This feature identifier isn't available on Windows threads build. We created a new feature identifier, gauche.sys.threads, which is defined in both pthreads build and Windows threads build, and suitable for the Scheme programs that wants to switch behavior based on the availability of threads.

  (cond-expand
    [gauche.sys.threads
      ... code using threads ...]
    [else
      ... code not using threads ...])

The feature id gauche.sys.pthreads is still available on pthreads build, and a new feature id gauche.sys.wthreads is available on Windows threads build, in case if you need finer distinction of the thread library (but there's hardly visible difference in Scheme level).

Better thread safety

Kirill Zorin is using Gauche in a way that is a good stress test for Gauche's thread support, and he has identified and fixed numerous thread-related bugs. Thanks, Kirill! I won't surprise if we find more, but I'm quite happy about the improvement.

Out-of-source-tree build

In the very early stage, we made it so that Gauche can be build in separate directory from the source tree, but it has been broken since then. It's not trivial to fix since Gauche needs multi-stage build, that is, one process generates a source file to be compiled, and running the compiled one generates another source file, and so on. Now I finsished updating various *.in files so that it could compile out of source tree again.

To build in a different directory, just call the 'configure' script of the source tree from the build directory, e.g.

  $ ls
  Gauche
  $ mkdir Gauche-build
  $ cd Gauche-build
  $ ../Gauche/configure
  $ make

Lazy sequences

Finally documented lazy sequences and generators. Check out the chapter of "Lazy evaluation", and also "gauche.sequence" and "gauche.lazy" modules.

Tags: Threads, gauche.lazy, gauche.sequence

Post a comment

Name: