Mercurial Hosting > luan
changeset 1255:4f571a974132
replace Thread.schedule with Thread.once and Thread.repeating
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 03 Sep 2018 06:13:55 -0600 |
parents | beebd0f5f2ba |
children | c147e2e877e3 |
files | conv.txt src/luan/modules/Thread.luan |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/conv.txt Sun Sep 02 09:04:38 2018 -0600 +++ b/conv.txt Mon Sep 03 06:13:55 2018 -0600 @@ -1,6 +1,7 @@ +"Thread.schedule" + "Thread.safe" - "Http.uncache_site" "full_path" "Http.version"
--- a/src/luan/modules/Thread.luan Sun Sep 02 09:04:38 2018 -0600 +++ b/src/luan/modules/Thread.luan Mon Sep 03 06:13:55 2018 -0600 @@ -28,9 +28,14 @@ ThreadLuan.fork(fn,...) end -function Thread.schedule(delay,repeated,fn,...) +function Thread.once(delay,fn,...) fn = safe(fn) - ThreadLuan.schedule(delay,repeated,fn,...) + ThreadLuan.schedule(delay,false,fn,...) +end + +function Thread.repeating(delay,fn,...) + fn = safe(fn) + ThreadLuan.schedule(delay,true,fn,...) end