; The same shared borrow of Share data may be lent to two tasks. ; expect: run ; schedules: 10 ; result: 42 ; phase: 3 ; spec: docs/spec/04-concurrency-and-atomics.md module test.tasks_shared_read air 0 lang 0.1 features [arrays, ownership, tasks] fn @main() -> u64 effects [task.spawn] entry: %x = local.alloc u64 %v = const.u64 21 local.store %x, %v %r = borrow.ref %x %sc = task.scope.begin %t1 = task.spawn %sc, @read(%r) %t2 = task.spawn %sc, @read(%r) %a = task.join %t1 %b = task.join %t2 task.scope.end %sc borrow.end %r %sum = add.checked.u64 %a, %b ret %sum fn @read(%p: ref) -> u64 effects [] entry: %v = load %p ret %v