Nope. That just caused it to freeze with the colorful spinning wheel. Rather than quitting and crashing.TechnoCat wrote:Try Thread:kill() in love.quit()Jasoco wrote:Maybe if you added a thread stopping code to a love.run() function of your own that would be called when you quit, it would end better instead of crashing. How exactly would you go about stopping any running threads in the middle of their run? Apparently it's not thread:stop().
multithreading love with love.thread
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: multithreading love with love.thread
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: multithreading love with love.thread
Please don't call kill, didn't I put a warning on the wiki?!
Anyway, I don't think this is a bug with threading though, what happens when you use a really basic thread, or when you put the thread code in the main thread?
Anyway, I don't think this is a bug with threading though, what happens when you use a really basic thread, or when you put the thread code in the main thread?
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: multithreading love with love.thread
Well, I did notice if I quit right after the first image, but before the second one, it doesn't crash. So maybe it has something to do with calling it more than once?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: multithreading love with love.thread
I updated the original post to not have dumb loops in it. Also, you can quit the thread with 'q'.
- saiko-chriskun
- Prole
- Posts: 6
- Joined: Wed Dec 01, 2010 8:13 pm
Re: multithreading love with love.thread
what are the advantages of love.thread over lua's built-in coroutines?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: multithreading love with love.thread
Coroutines are not truly threads. It is my understanding coroutines in Lua will only execute one thread at a time.saiko-chriskun wrote:what are the advantages of love.thread over lua's built-in coroutines?
http://lua-users.org/wiki/CoroutinesTutorial
Coroutines in Lua are not operating system threads or processes. Coroutines are blocks of Lua code which are created within Lua, and have their own flow of control like threads. Only one coroutine ever runs at a time, and it runs until it activates another coroutine, or yields (returns to the coroutine that invoked it).
Re: multithreading love with love.thread
Coroutines don't allow concurrent execution. If you resume a coroutine, the coroutine has to yield before control returns to the caller. You can do cooperative multitasking by cycling through coroutines and resuming them (each coroutine decides how much time it gets, and can potentially never yield controller), whereas threads allow preemptive multitasking (the task scheduler decides how much time a thread gets).saiko-chriskun wrote:what are the advantages of love.thread over lua's built-in coroutines?
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: multithreading love with love.thread
How would I pass a luasocket connection to a thread? EDIT: https://bitbucket.org/rude/love/issue/2 ... assing-non
Also, can threads create threads? EDIT: require love.filesystem first.
Also, can threads create threads? EDIT: require love.filesystem first.
Last edited by TechnoCat on Thu Jun 23, 2011 11:24 pm, edited 1 time in total.
- Taehl
- Dreaming in associative arrays
- Posts: 1025
- Joined: Mon Jan 11, 2010 5:07 am
- Location: CA, USA
- Contact:
Re: multithreading love with love.thread
I don't think you can pass connections to threads because, unless I'm mistaken, you can only pass strings and I don't think you can serialize a connection.
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
- slime
- Solid Snayke
- Posts: 3162
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: multithreading love with love.thread
You can send and received pretty much anything (including userdata) except tables, AFAIK.
Who is online
Users browsing this forum: Bing [Bot] and 9 guests