From 8ceeb5f83f22ed3db06fc02bb23710ccc1dbbb90 Mon Sep 17 00:00:00 2001 From: olpc user Date: Mon, 9 Dec 2019 03:26:04 -0800 Subject: use tls contexts for habits --- starts/meaning-vm/habit-starts/rhythm.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'starts/meaning-vm/habit-starts') diff --git a/starts/meaning-vm/habit-starts/rhythm.cpp b/starts/meaning-vm/habit-starts/rhythm.cpp index 33e102a..7afb8ed 100644 --- a/starts/meaning-vm/habit-starts/rhythm.cpp +++ b/starts/meaning-vm/habit-starts/rhythm.cpp @@ -34,22 +34,22 @@ int main() #undef self ahabit(next-habit, { - ref n = ctx.get(active-habit).get(next); + ref n = ctx[active-habit].get(next); ctx.set(active-habit, n); - return n(ctx); + return n(); }); ahabit(start-habit, { - ref s = ctx.get(start); + ref s = ctx[start]; ctx.set(active-habit, s); - return s(ctx); + return s(); }); ahabit(keep-doing-habit, { - (start-habit)(ctx); + (start-habit)(); while (true) { - (next-habit)(ctx); + (next-habit)(); } }); @@ -124,7 +124,6 @@ int main() }); - a(context, habit-context); - (habit-context).set(start, start-beat); - (keep-doing-habit)(habit-context); + ref::context().set(start, start-beat); + (keep-doing-habit)(); } -- cgit v1.2.3