diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-12-07 23:11:53 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-12-07 23:13:20 +0100 |
commit | 51fc066ae25a0e1aa272a2eba9ecd7b42dc9ea41 (patch) | |
tree | 90cf2f7f2e0e9524e10f2de828208c791a3ddeef /doc/ref/api-scheduling.texi | |
parent | f0c0141fe4bd478edc8205b1eae793f0474d4aa3 (diff) | |
download | guile-51fc066ae25a0e1aa272a2eba9ecd7b42dc9ea41.tar.gz |
Use `current-processor-count' to determine the number of future-workers.
* module/ice-9/futures.scm (%worker-count): Use
`current-processor-count'.
* doc/ref/api-scheduling.texi (Futures): Add note about side-effects and
I/O. Mention `current-processor-count'.
Diffstat (limited to 'doc/ref/api-scheduling.texi')
-rw-r--r-- | doc/ref/api-scheduling.texi | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/doc/ref/api-scheduling.texi b/doc/ref/api-scheduling.texi index 28e90e3d1..d202f4a69 100644 --- a/doc/ref/api-scheduling.texi +++ b/doc/ref/api-scheduling.texi @@ -848,12 +848,18 @@ machine, though, the computation of @code{(find prime? lst2)} may be done in parallel with that of the other @code{find} call, which can reduce the execution time of @code{find-prime}. +Note that futures are intended for the evaluation of purely functional +expressions. Expressions that have side-effects or rely on I/O may +require additional care, such as explicit synchronization +(@pxref{Mutexes and Condition Variables}). + Guile's futures are implemented on top of POSIX threads (@pxref{Threads}). Internally, a fixed-size pool of threads is used to evaluate futures, such that offloading the evaluation of an expression to another thread doesn't incur thread creation costs. By default, the -pool contains one thread per CPU core, minus one, to account for the -main thread. +pool contains one thread per available CPU core, minus one, to account +for the main thread. The number of available CPU cores is determined +using @code{current-processor-count} (@pxref{Processes}). @deffn {Scheme Syntax} future exp Return a future for expression @var{exp}. This is equivalent to: |