Replies: 1 comment 2 replies
-
Continuations can be cancelled by assigning nil to their function pointers, inside or outside of the continuation. Alternatively, assign nil as the value of the continuation itself. Single-threaded applications don't need synchronization primitives per se; any value will suffice. Multi-threaded applications can synchronize using primitives such as those provided by pthreads. As far as light-weight synchronization goes, there are a couple exclusive locks that I want to implement as an exercise, and we have a so-called "cubby" implementation in my More cps-friendly constructions of this sort are very welcome, though. For example, we could use a lock-free double-ended queue implementation for work-stealing algorithms. @shayanhabibi probably has a few more ideas along these lines... |
Beta Was this translation helpful? Give feedback.
-
i think about such api
i saw zevv/actors lib setting links when spawn new actor from another but how to make it transparent for user? So user will not need to link each task himself, user will only think is it task should be waited right now or it can run parallel.
i think i can create my macro calls
task
and replace each cps call with link function? but there will be problem with mixing cps and noncps functions because parenting with this will lost. Then i think maybe somehow store parent information on stack and somehow quickly obtain last current cps running.i mean calls like this:
cps -> regular fn -> cps
. or maybe it is useless because i only see such pattern with async but regular function still returning Future type and with cps we will always use cps if function does something interruptiblethen it would be interesting to think about how to make synchronization functions like all, race
also this is master-worker synchronisation patterns but what if we wanting to synchronize workers? we should use locks, do we have cps locks already?
Beta Was this translation helpful? Give feedback.
All reactions