Mercurial Hosting > luan
comparison src/luan/modules/ThreadLuan.java @ 1308:70eecde81820
remove fn,... to improve readability
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Wed, 23 Jan 2019 23:37:02 -0700 |
parents | 5345466fa61f |
children | d5739c101bd6 |
comparison
equal
deleted
inserted
replaced
1307:6c8ceca4a10b | 1308:70eecde81820 |
---|---|
21 | 21 |
22 public final class ThreadLuan { | 22 public final class ThreadLuan { |
23 private static final Executor exec = Executors.newCachedThreadPool(); | 23 private static final Executor exec = Executors.newCachedThreadPool(); |
24 public static final ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1); | 24 public static final ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1); |
25 | 25 |
26 public static void fork(LuanState luan,LuanFunction fn,Object... args) { | 26 public static void fork(LuanState luan,LuanFunction fn) { |
27 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); | 27 LuanCloner cloner = new LuanCloner(LuanCloner.Type.COMPLETE); |
28 final LuanState newLuan = (LuanState)cloner.clone(luan); | 28 final LuanState newLuan = (LuanState)cloner.clone(luan); |
29 final LuanFunction newFn = (LuanFunction)cloner.get(fn); | 29 final LuanFunction newFn = (LuanFunction)cloner.get(fn); |
30 final Object[] newArgs = cloner.clone(args); | |
31 exec.execute(new Runnable(){public void run() { | 30 exec.execute(new Runnable(){public void run() { |
32 try { | 31 try { |
33 newFn.call(newLuan,newArgs); | 32 newFn.call(newLuan); |
34 } catch(LuanException e) { | 33 } catch(LuanException e) { |
35 e.printStackTrace(); | 34 e.printStackTrace(); |
36 } | 35 } |
37 }}); | 36 }}); |
38 } | 37 } |