changeset 1780:d3ea0380dfb6

rename Thread.fork to Thread.run
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 30 Aug 2023 14:40:45 -0600
parents 96dbbdf1e368
children e647c92a4a12
files src/luan/host/main.luan src/luan/modules/Rpc.luan src/luan/modules/Thread.luan src/luan/modules/ThreadLuan.java src/luan/modules/http/Server.luan
diffstat 5 files changed, 12 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/host/main.luan	Tue Aug 15 23:52:20 2023 -0600
+++ b/src/luan/host/main.luan	Wed Aug 30 14:40:45 2023 -0600
@@ -178,4 +178,4 @@
 
 fns.call = WebHandler.callSite
 
-Thread.fork(Rpc.serve)
+Thread.run(Rpc.serve)
--- a/src/luan/modules/Rpc.luan	Tue Aug 15 23:52:20 2023 -0600
+++ b/src/luan/modules/Rpc.luan	Wed Aug 30 14:40:45 2023 -0600
@@ -225,7 +225,7 @@
 					responder and responder.after_close and responder.after_close()
 				end
 			end
-			Thread.fork(server)
+			Thread.run(server)
 		catch e
 			logger.error(e)
 		end
--- a/src/luan/modules/Thread.luan	Tue Aug 15 23:52:20 2023 -0600
+++ b/src/luan/modules/Thread.luan	Wed Aug 30 14:40:45 2023 -0600
@@ -3,6 +3,7 @@
 local ReentrantLock = require "java:java.util.concurrent.locks.ReentrantLock"
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
+local new_error = Luan.new_error or error()
 local set_metatable = Luan.set_metatable or error()
 local Time = require "luan:Time.luan"
 local Logging = require "luan:logging/Logging.luan"
@@ -24,9 +25,14 @@
 end
 Thread.safe = safe
 
-function Thread.fork(fn)
+function Thread.run(fn)
 	fn = safe(fn)
-	ThreadLuan.fork(fn)
+	ThreadLuan.run(fn)
+end
+
+function Thread.fork(fn)
+	logger.error(new_error("Thread.fork is obsolete"))
+	Thread.run(fn)
 end
 
 function Thread.schedule(fn,options)
--- a/src/luan/modules/ThreadLuan.java	Tue Aug 15 23:52:20 2023 -0600
+++ b/src/luan/modules/ThreadLuan.java	Wed Aug 30 14:40:45 2023 -0600
@@ -48,7 +48,7 @@
 		};
 	}
 
-	public static void fork(Luan luan,LuanFunction fn) throws LuanException {
+	public static void run(Luan luan,LuanFunction fn) throws LuanException {
 		luan = new Luan(luan);
 		LuanMutable.makeImmutable(fn);
 		exec.execute(runnable(luan,fn));
--- a/src/luan/modules/http/Server.luan	Tue Aug 15 23:52:20 2023 -0600
+++ b/src/luan/modules/http/Server.luan	Wed Aug 30 14:40:45 2023 -0600
@@ -59,7 +59,7 @@
 	function Rpc.functions.call(domain,fn_name,...)
 		return luan_handler.call_rpc(fn_name,...)
 	end
-	Thread.fork(Rpc.serve)
+	Thread.run(Rpc.serve)
 end
 
 local file_regex = regex("^file:(.*)$")