diff options
| author | 2026-10-15 14:33:28 +0330 | |
|---|---|---|
| committer | 2026-10-15 14:33:28 +0330 | |
| commit | 25aa655e5b9464e291d542081ed1cf0f8fd666af (patch) | |
| tree | fb2fa4b3e77914ab00829b39142a2f8cfb3a9d8b /tests/hold/accept/reentrant.zc | |
| parent | hold blocks: top-level hold { shared let ...; fn ... } monitors; shared value... (diff) | |
hold: fixtures (accept, reject, race, rank order) and tests/drivers/hold_test.py
Diffstat (limited to 'tests/hold/accept/reentrant.zc')
| -rw-r--r-- | tests/hold/accept/reentrant.zc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/hold/accept/reentrant.zc b/tests/hold/accept/reentrant.zc new file mode 100644 index 0000000..f0c8293 --- /dev/null +++ b/tests/hold/accept/reentrant.zc @@ -0,0 +1,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; } |
