aboutsummaryrefslogtreecommitdiff
path: root/tests/hold/accept/reentrant.zc
blob: f0c82938097ace222acb67088dce62bf9a0b2ff8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
// expect: 3 1
// a function of a block calling another of the same block doesn't take the lock again, and a later block may be entered from an earlier one
namespace;
include rt;
int later();
hold {
    shared let depth, calls;
    fn inner() { calls++; return depth; }
    fn outer() { depth = depth + 1; inner(); inner(); inner(); return calls; }
}
hold { shared let seen; fn later() { seen++; return seen; } }
fn main() { rt.put_n(outer()); rt.put_c(' '); rt.put_n(later()); rt.put_c(10); return 0; }