JnCrMx / discord-game-sdk4j

Java bindings for Discord's Game SDK
MIT License
121 stars 23 forks source link

Activity.java spawns a non-daemon "Activity-Cleaner" thread #33

Closed chrislo27 closed 2 years ago

chrislo27 commented 3 years ago

In Activity.java, a new thread QUEUE_THREAD is made which appears to help with cleaning up references when an Activity is constructed with a pointer. I am aware that that constructor is not supposed to be used as part of the public API.

Is it required that QUEUE_THREAD be a non-daemon thread for cleanup to work correctly? If not, I suggest making it a daemon thread so that applications shut down correctly (i.e., when the only threads remaining are daemons).

Thanks for the work you've put into this project!

JnCrMx commented 3 years ago

I think it's not a daemon, because I wasn't aware of that option (and the problem caused by not using it) when I was writing that code. I don't think that it is required to be a non-daemon for the cleanup to work. I'm going to try making it a daemon tomorrow (unless you tested it already) and see if it behaves well.

Thank you for bringing this to my attention.

chrislo27 commented 3 years ago

I'm building my project with your recent commit 2b5a903 and so far it seems good and the application terminates appropriately. I'll let you know if I encounter issues with the change. Thank you again!