moonlight-stream / moonlight-common-c

Core implementation of Nvidia's GameStream protocol
GNU General Public License v3.0
448 stars 166 forks source link

Implement detached threads #88

Closed GaryOderNichts closed 7 months ago

GaryOderNichts commented 7 months ago

The AsyncTerm thread is never joined but its handle is immediately closed. This works fine on Windows, but causes issues on other platforms where threads need to be explicitly detached if never joined (pthread, wiiu).

This adds a new PltDetachThread function, which can be used instead of PltCloseThread to explictly detach a thread, requiring it to no longer be closed.

Note that this hasn't been tested on any platforms other than Wii U. The vita code needs needs to be checked, since I'm not sure if sceKernelDeleteThread behaves like Windows (detaching the thread) or immediately terminating the thread when called.