aboutsummaryrefslogtreecommitdiffstats
path: root/ractor_core.h
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2021-01-22 04:38:50 +0900
committerKoichi Sasada <ko1@atdot.net>2021-01-22 12:16:37 +0900
commitfff1edf23ba28267bf57097c269f7fa87530e3fa (patch)
treeb4e2d9bcf44aac5e3423d7d099805150cc979e94 /ractor_core.h
parentd0d6227a0da5925acf946a09191f172daf53baf2 (diff)
downloadruby-fff1edf23ba28267bf57097c269f7fa87530e3fa.tar.gz
fix Ractor.yield(obj, move: true)
Ractor.yield(obj, move: true) and Ractor.select(..., yield_value: obj, move: true) tried to yield a value with move semantices, but if the trial is faild, the obj should not become a moved object. To keep this rule, `wait_moving` wait status is introduced. New yield/take process: (1) If a ractor tried to yield (move:true), make taking racotr's wait status `wait_moving` and make a moved object by `ractor_move(obj)` and wakeup taking ractor. (2) If a ractor tried to take a message from a ractor waiting fo yielding (move:true), wakeup the ractor and wait for (1).
Diffstat (limited to 'ractor_core.h')
-rw-r--r--ractor_core.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/ractor_core.h b/ractor_core.h
index 2516277f4f..fb104cd22c 100644
--- a/ractor_core.h
+++ b/ractor_core.h
@@ -61,6 +61,7 @@ struct rb_ractor_sync {
wait_receiving = 0x01,
wait_taking = 0x02,
wait_yielding = 0x04,
+ wait_moving = 0x08,
} status;
enum ractor_wakeup_status {