Do requires in threads get cached? Are they cached separately from the main thread?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Guard13007
Party member
Posts: 132
Joined: Sat Oct 25, 2014 3:42 am
Location: Internet, USA
Contact:

Do requires in threads get cached? Are they cached separately from the main thread?

Post by Guard13007 »

What the title says.

Do threads cache require'd modules?

And if they do, is this the same cache as the main thread? Or do threads get their own cache?
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Do requires in threads get cached? Are they cached separately from the main thread?

Post by zorg »

Threads (real ones with love.thread, not coroutines) have their own Lua states;
They don't "share" anything on the lua side, which includes modules required (including löve's ones like love.timer; love.thread is the only one that gets loaded automatically... although love.filesystem gets loaded too since either 0.9 or 0.10)

Also, all of this is on the wiki: love.thread
Me and my stuff :3True 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.
User avatar
Guard13007
Party member
Posts: 132
Joined: Sat Oct 25, 2014 3:42 am
Location: Internet, USA
Contact:

Re: Do requires in threads get cached? Are they cached separately from the main thread?

Post by Guard13007 »

I don't believe that answers my question. I am aware that Love modules must be loaded and that they are their own states, but they also allows flat tables and userdata to be shared. I am wondering if that sharing applies to cached modules (although based on having to require love's modules and it being a separate state, I'm guessing no). And I'm guessing now that this means they /do/ cache require'd modules in their own thread only.

Edit: Sorry if I sounded rude. I'm half awake and trying to just make sure I understand it properly. >.<
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Do requires in threads get cached? Are they cached separately from the main thread?

Post by bartbes »

No, even data sent over channels isn't shared unless they're love objects. The tables are copied over, and, of course, you can't send functions to begin with.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 46 guests