File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -605,6 +605,10 @@ function ltask.no_response()
605605 session_coroutine_response [running_thread ] = nil
606606end
607607
608+ function ltask .servicepath (path )
609+ return ltask .call (SERVICE_ROOT , " servicepath" , path )
610+ end
611+
608612function ltask .spawn (name , ...)
609613 return ltask .call (SERVICE_ROOT , " spawn" , name , ... )
610614end
@@ -812,7 +816,7 @@ local function sys_service_init(t)
812816 -- The first system message
813817 _G .require = yieldable_require
814818 local initfunc = assert (load (t .initfunc ))
815- local func = assert (initfunc (t .name ))
819+ local func = assert (initfunc (t .name , t . path ))
816820 local handler = func (table.unpack (t .args ))
817821 ltask .dispatch (handler )
818822 if service == nil then
Original file line number Diff line number Diff line change @@ -126,6 +126,7 @@ local function spawn(t)
126126 ltask .syscall (address , " init" , {
127127 initfunc = t .initfunc or config .initfunc ,
128128 name = t .name ,
129+ path = t .path ,
129130 args = t .args or {},
130131 })
131132 return address
@@ -188,9 +189,16 @@ function S.tracelog(timeout)
188189 return tlog
189190end
190191
192+ local SERVICE_PATH
193+
194+ function S .servicepath (path )
195+ SERVICE_PATH = path
196+ end
197+
191198function S .spawn (name , ...)
192199 return spawn {
193200 name = name ,
201+ path = SERVICE_PATH ,
194202 args = {... },
195203 }
196204end
206214function S .uniqueservice (name , ...)
207215 return spawn_unique {
208216 name = name ,
217+ path = SERVICE_PATH ,
209218 args = {... },
210219 }
211220end
You can’t perform that action at this time.
0 commit comments