136 |
======================= |
======================= |
137 |
|
|
138 |
As in the current system, it should not be permitted to invoke a |
As in the current system, it should not be permitted to invoke a |
139 |
continuation that was captured by a different thread. This can be |
continuation that was captured by a different thread. This could be |
140 |
implemented by storing the current thread id in the continuation when |
implemented by storing the current thread id in the continuation when |
141 |
it's captured. When the continuation is invoked, the stored id can be |
it's captured and comparing with the current id when the continuation |
142 |
compared with the current id. |
is invoked. |
143 |
|
|
144 |
For each thread, we can have a simple list representing the |
To implemnent the continuation barrier, for each thread we can have a |
145 |
call-with-continuation-barrier (cwcb) dynamic state. The head of the |
simple list representing the barrier (let's call it |
146 |
|
call-with-continuation-barrier, cwcb) dynamic state. The head of the |
147 |
list would be stored in a thread-local location. Whenever the scope |
list would be stored in a thread-local location. Whenever the scope |
148 |
of a cwcb expression is entered, a new cons cell could be inserted at |
of a cwcb expression is entered, a new cons cell could be inserted at |
149 |
the head of the list. When the scope is exited, the cell would be |
the head of the list. When the scope is exited, the cell would be |
151 |
catch non-local exit. Non-local exit or entry by continuation will |
catch non-local exit. Non-local exit or entry by continuation will |
152 |
not be possible). A pointer to the cell at the head of the list would |
not be possible). A pointer to the cell at the head of the list would |
153 |
be stored in a continuation when it is captured. When a continuation |
be stored in a continuation when it is captured. When a continuation |
154 |
is invoked, the stored cell pointer can be compared with the current |
is invoked, the stored cell pointer can be compared with the address |
155 |
head of the list. |
of the cell currently at the head of the list. |
156 |
|
|
157 |
|
This cwcb list comparison would also prevent cross-thread invokation, |
158 |
|
so comparison of thread-ids can be dropped. |
159 |
|
|
160 |
Convenience |
Convenience |
161 |
=========== |
=========== |
207 |
-- http://sources.redhat.com/ml/guile/2000-03/msg00461.html |
-- http://sources.redhat.com/ml/guile/2000-03/msg00461.html |
208 |
Jim Blandy suggested looking at a few articles, but these appear to |
Jim Blandy suggested looking at a few articles, but these appear to |
209 |
propose more fundamental changes to the concept of call/cc. |
propose more fundamental changes to the concept of call/cc. |
210 |
|
|
211 |
|
Thread on guile-devel mailing list discussing the use of |
212 |
|
call-with-dynamic-root by applications, Sept 2001. |
213 |
|
-- http://mail.gnu.org/pipermail/guile-devel/2001-September/003684.html |