1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00
Commit graph

4 commits

Author SHA1 Message Date
Ludovic Courtès
8a177d316c futures: Limit the number of nested futures on the same stack.
Fixes <http://bugs.gnu.org/13188>.
Reported by Nala Ginrut <nalaginrut@gmail.com>.

* module/ice-9/futures.scm (%nesting-level): Rename to...
  (%nesting-level): ... this.  Default to 0 instead of #f.  Update
  users.
  (%max-nesting-level): New variable.
  (touch): When FUTURE is queued and (%nesting-level) is above
  %MAX-NESTING-LEVEL, abort to %FUTURE-PROMPT.
* test-suite/tests/future.test ("nested futures")["loop"]: Remove
  `compile' call.
* test-suite/tests/threads.test ("par-map")["long list"]: New test.
* doc/ref/api-scheduling.texi (Futures): Add a paragraph about stack
  consumption.
2013-03-27 18:09:49 +01:00
Ludovic Courtès
3e529bf02a futures: Allow nested futures; put the main thread to work.
* module/ice-9/futures.scm (%futures-waiting, %within-future?,
  %future-prompt): New variables.
  (let/ec): New macro.
  (process-future!): Run FUTURE's thunk in a prompt; capture FUTURE's
  continuation when it aborts, and add it to %FUTURES-WAITING.  Set
  %WITHIN-FUTURE? in the dynamic extent of the call FUTURE's thunk.
  (process-futures): Move loop body to...
  (process-one-future): ... here.  New procedure.
  (notify-completion): New procedure.
  (touch)[work, loop]: New procedures.
  When %WITHIN-FUTURE? and FUTURE is started, abort; if not
  %WITHIN-FUTURE, call `work' while waiting.
  When FUTURE is queued, call `work' too.

* test-suite/tests/future.test ("nested futures"): New tests.
2012-11-21 23:33:30 +01:00
Ludovic Courtès
6c17f7bd71 futures: Support multiple-value returns.
* module/ice-9/futures.scm (process-future!): Use `call-with-values'
  when invoking `(future-thunk future)'.

* test-suite/tests/future.test ("futures")["multiple values"]: New test.
2010-12-16 23:45:24 +01:00
Ludovic Courtès
0d4e6ca38f Add `(ice-9 futures)'.
* doc/ref/api-scheduling.texi (Threads): Add short introduction.
  Mention the `threads' feature.  Add cross-reference to futures.
  (Futures): New node.

* module/Makefile.am (ICE_9_SOURCES): Add `ice-9/futures.scm'.

* module/ice-9/futures.scm: New file.

* test-suite/Makefile.am (SCM_TESTS): Add `tests/future.test'.

* test-suite/tests/future.test: New file.
2010-12-03 00:38:29 +01:00