danielga / gmod_lanes Goto Github PK
View Code? Open in Web Editor NEWModules for Garry's Mod that add threads through Lua Lanes.
Home Page: https://github.com/danielga/gmod_lanes
License: Other
Modules for Garry's Mod that add threads through Lua Lanes.
Home Page: https://github.com/danielga/gmod_lanes
License: Other
Precompiled build is missing.
Improve the readme, just like with danielga/gm_filesystem#6 and all of the other issues that I've made today.
It's lovely
lua/includes/modules/lanes.lua:567: ASSERT failed: ......\lanes\src\lanes.c:2192 'nargs >= 0'
require'lanes'
lanes.configure()
Took this file https://github.com/danielga/gmod_lanes/blob/master/lanes.lua
error: timer_lane = gen( "*", { package= {}, priority = max_prio}, timer_body)() -- "*" instead of "io,package" for LuaJIT compatibility...
crash: https://github.com/danielga/gmod_lanes/releases/download/downloadables/lanes.lua
`require'lanes'
if lanes.configure then
lanes.configure()
end
function firstThread()
print('Hello World')
end
genFirstThread = lanes.gen( "*",firstThread )()`
Does this specific limitation apply to the module
"Multi-CPU is done with OS threads, not processes. A lane is a Lua full userdata, therefore it will exist only as long as the Lua state that created it still exists. Therefore, a lane won't continue execution after the main program's termination."
Specifically the part about using OS threads not processes. aswell if this limitation does apply, is there already a means of removing old lanes no longer being used when say a server shuts down? For example lets say 4 lanes were made and then the normal gmod lua state. when srcds is shut down, do these lanes get cleaned up with it or no? and if not is it possible to implement a means of cleaning them up?
[ERROR] lua/includes/modules/lanes.lua:571: main: function 'lanes_core/now_secs' not found in Lane #0x27b77c30 destination transfer database.
- unknown - [C]:-1
- configure - lua/includes/modules/lanes.lua:571
3. unknown - addons/stuff/lua/stuff/sv_lanes_test.lua:21
4. include - [C]:-1
5. unknown - addons/stuff/lua/autorun/stuff_load.lua:74
Hello,
I've tried compiling gmod_lanes with most recent garrysmod_common.
While there's no recommended garrysmod_common revision specified, I think it wouldn't work with recent garry's mod versions anyways.
Here are compiler errors:
../../../lanes/src/tools.c:189:21: error: initializer element is not constant
189 | { LUA_LOADLIBNAME, luaopen_package},
| ^~~~~~~~~~~~~~~
../../../lanes/src/tools.c:189:21: note: (near initialization for ‘libs[0].func’)
../../../lanes/src/tools.c:190:20: error: initializer element is not constant
190 | { LUA_TABLIBNAME, luaopen_table},
| ^~~~~~~~~~~~~
../../../lanes/src/tools.c:190:20: note: (near initialization for ‘libs[1].func’)
../../../lanes/src/tools.c:191:20: error: initializer element is not constant
191 | { LUA_STRLIBNAME, luaopen_string},
| ^~~~~~~~~~~~~~
../../../lanes/src/tools.c:191:20: note: (near initialization for ‘libs[2].func’)
../../../lanes/src/tools.c:192:21: error: initializer element is not constant
192 | { LUA_MATHLIBNAME, luaopen_math},
| ^~~~~~~~~~~~
../../../lanes/src/tools.c:192:21: note: (near initialization for ‘libs[3].func’)
../../../lanes/src/tools.c:194:19: error: initializer element is not constant
194 | { LUA_OSLIBNAME, luaopen_os},
| ^~~~~~~~~~
../../../lanes/src/tools.c:194:19: note: (near initialization for ‘libs[4].func’)
../../../lanes/src/tools.c:195:19: error: ‘luaopen_io’ undeclared here (not in a function); did you mean ‘luaopen_jit’?
195 | { LUA_IOLIBNAME, luaopen_io},
| ^~~~~~~~~~
| luaopen_jit
../../../lanes/src/tools.c:208:19: error: initializer element is not constant
208 | { LUA_DBLIBNAME, luaopen_debug},
| ^~~~~~~~~~~~~
../../../lanes/src/tools.c:208:19: note: (near initialization for ‘libs[7].func’)
Notice error: ‘luaopen_io’ undeclared here (not in a function)
part, it seems like it didn't even take luaopen_io declaration in main.cpp into account.
Is there any recommendations on how to resolve this issue?
[ERROR] lua/includes/modules/hook.lua:84: main: function 'ents/GetAll' not found in Lane #0x2fc3b9b8 destination transfer database.
- v - [C]:-1
- unknown - lua/includes/modules/hook.lua:84
My code:
require('lanes')
if !lanes.gen then lanes.configure() end
local ents_GetAll = ents.GetAll
local ipairs = ipairs
local print = print
hook.Add('Think', 'lanes.test', lanes.gen(function()
local entities = ents_GetAll()
for k,v in ipairs(entities) do
print(v)
end
return true
end))
pretty much what the title says. like something that would demonstrate how to put two separate things running on separate threads with this
So I have been having an issue today with getting the module to actually work. I'm currently running this on SRCDS default branch for windows. The issue seems to be related to the lanes.gen() function. depends on if I have the first perameter as a string or just the function. I've also tried with setting the first perameter as "" and "base" aswell with the same crash issue happening.
I tried asking on the LuaLanes repo in hopes that it was just an issue of not properly using the lanes.gen() function but I didn't really get any clue of whats causing the issue and from what I understand I am doing things correctly in my lua file.
This is the code I currently have:
require("lanes")
lanes.configure()
local e_func = lanes.gen("*",function(n)
for i=1,n do
print("Thead E is running")
end
end)
local f_func = lanes.gen("*",function(n)
for i=1,n do
print("Thead F is running")
end
end)
function TestLanes() --Crash happens the moment this function is called
local E = e_func(1000)
local F = f_func(1000)
print(E[1],F[1])
end
If I remove the "*" from the lanes.gen() however, the crash does not occure. Instead I get this error happening.
[ERROR] main: function 'print' not found in Lane #0x2c2801c0 destination transfer database.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.