futures: Limit the number of nested futures on the same stack.
authorLudovic Courtès <ludo@gnu.org>
Wed, 27 Mar 2013 17:03:47 +0000 (18:03 +0100)
committerLudovic Courtès <ludo@gnu.org>
Wed, 27 Mar 2013 17:09:49 +0000 (18:09 +0100)
commit8a177d316c0062afe74f9a761ef460e297435e59
tree8cba3ce3b9440946a7b294a1a873b602a712ede0
parent8cd109bf0a10e37c26bf476fed81a0d4282d13c6
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.
doc/ref/api-scheduling.texi
module/ice-9/futures.scm
test-suite/tests/future.test
test-suite/tests/threads.test