1. Anders Ruud
  2. love
  3. Issues


Issue #522 invalid

Thread names seem unnecessary

created an issue

Thread names only seem to be used (on the API level) by love.thread.getThreads and love.thread.getThread when called with a thread name.

Since newThread returns the newly created thread, I suggest that thread names aren't actually necessary. A thread can be used by the thread which created it simply by using what was returned by newThread, and if it needs be used in another thread it can be sent to it like any other value.

I've never seen getThreads used, and I've seen getThread called with a thread name twice, and in both instances it was easier to simply use the thread as returned by newThread.

I propose that thread names not be required by newThread, and that getThreads, the variant of getThread which accepts a thread name, and Thread:getName be removed from the API (unless of course there is a compelling need for these things).

Edit/Note: I have no idea what I'm talking about and maybe easy inter-thread communication can be really useful. I just wanted to point out that the concept of thread names "has" to be dealt with in order to use threads as they're required when creating threads, and at least I have never really seen them used.

Comments (4)

  1. Bart van Strien

    This is no longer the case in minor, with its new communication api (channels), it is no longer needed to identify a thread. With the current messaging it is extremely useful to address threads by name, though.

    I'd also like to note that, since you aren't meant to create an throw away threads a lot, you generally shouldn't be impacted too much by having to name threads uniquely.

    EDIT: Also, getThreads is not the variant that gets a thread by name..

  2. Log in to comment