Hello,
When I try to restart my game via love.event.quit("restart") and there is at least one running thread, the game will exit with following message: Error: [string "boot.lua"]:230: Already initialized
How can I avoid this? Do I have to take care, that every thread is closed when trying to restart?
I am using love 0.10.2.
love.event.quit("restart") crashes when threads running
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
- slime
- Solid Snayke
- Posts: 3131
- Joined: Mon Aug 23, 2010 6:45 am
- Location: Nova Scotia, Canada
- Contact:
Re: love.event.quit("restart") crashes when threads running
love is not able to forcefully kill threads (partly because attempting to do so could cause a complete hang if a mutex lock was active, and it would also cause memory leaks).
It's up to your own code to make sure a thread ends properly when love quits. The love.quit callback is a good place to send messages through channels to indicate that threads should exit, and then Thread:wait should be called after the messages are sent (and you'll need code inside the thread to make it finish running when it receives a certain message, of course).
It's up to your own code to make sure a thread ends properly when love quits. The love.quit callback is a good place to send messages through channels to indicate that threads should exit, and then Thread:wait should be called after the messages are sent (and you'll need code inside the thread to make it finish running when it receives a certain message, of course).
Re: love.event.quit("restart") crashes when threads running
Haha slime beat me to it.
You need to kill and/or join your threads manually.
You need to kill and/or join your threads manually.
- zorg
- Party member
- Posts: 3436
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: love.event.quit("restart") crashes when threads running
(And before any confusion arises, raidho probably means by "join" what slime said above, Thread:wait, to be precise.)
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
- Luke100000
- Party member
- Posts: 232
- Joined: Mon Jul 22, 2013 9:17 am
- Location: Austria
- Contact:
Re: love.event.quit("restart") crashes when threads running
Thanks for the quick replies!
I will try out this solution.
I will try out this solution.
I actually was confused
Re: love.event.quit("restart") crashes when threads running
Join threads is the standard terminology for this action. LÖVE arbitrarily renames a lot of things, just to confuse people.
Who is online
Users browsing this forum: No registered users and 41 guests