I modify code of Helvecta, thanks.
And test on my quad-core PC on Windows 8.1.
This is cool, thanks for all developers of this module!
Threads in 0.9.0?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- AntonioModer
- Party member
- Posts: 202
- Joined: Fri Jun 15, 2012 5:31 pm
- Location: Belarus
- Contact:
Re: Threads in 0.9.0?
Last edited by AntonioModer on Fri Aug 14, 2015 7:40 am, edited 2 times in total.
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: Threads in 0.9.0?
Is this a single CPU? Cause otherwise this would mean threadding is very inefficient here - it should spread the threads accross the cpus...
Or is it showing the summed up work of all CPUs on your CPU monitor?
Or is it showing the summed up work of all CPUs on your CPU monitor?
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
- AntonioModer
- Party member
- Posts: 202
- Joined: Fri Jun 15, 2012 5:31 pm
- Location: Belarus
- Contact:
Re: Threads in 0.9.0?
4 coresGermanunkol wrote:Is this a single CPU?
YesGermanunkol wrote:Or is it showing the summed up work of all CPUs on your CPU monitor?
Re: Threads in 0.9.0?
Posting this for my sake and anyone else who comes looking for this:
When passing arguments to Thread:start() you can use the following to capture multiple args into a table for later use. I found this to be useful for passing a varying number of arguments to start().
Then in your main.lua script you might have something like this:
When passing arguments to Thread:start() you can use the following to capture multiple args into a table for later use. I found this to be useful for passing a varying number of arguments to start().
Code: Select all
-- thread.lua
-- ### gather args
local args = {}
local x = 1
while true do
local o = select(x, ...)
if o == nil then
break
end
table.insert(args, o)
x = x + 1
end
Code: Select all
-- main.lua
function love.load()
thread = love.thread.newThread("thread.lua")
channel = love.thread.getChannel("test")
thread:start('5000000000', 'Finished')
end
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: Threads in 0.9.0?
You're only 1.5 years late to the party…
I'd also like to point out you could replace your entire first snippet with 'local args = {...}'.
I'd also like to point out you could replace your entire first snippet with 'local args = {...}'.
Re: Threads in 0.9.0?
Very true. That being said, in my recent searches I wasn't able to find much else about threads and this post is still linked on the wiki page for threads.You're only 1.5 years late to the party…
That certainly makes things a lot simpler, thanks! I've only been working with Lua/LOVE for about a month now so I'm still learning the tricks of the trade.I'd also like to point out you could replace your entire first snippet with 'local args = {...}'.
Who is online
Users browsing this forum: No registered users and 101 guests