4
\$\begingroup\$

I'm looking to set up two threads in my puzzle game, one for logic/graphics, and one for audio. Am I correct in thinking that the thread that handles the audio should be set as a daemon thread, because the game can end without that thread finishing?

\$\endgroup\$
2
\$\begingroup\$

Yes, but.

  • If you exit using System.exit() then it will shut down your audio thread anyway.
  • It's probably tidier to send a message to the audio thread telling it to shut down and close its streams.
  • You should consider having three threads unless the logic is really simple.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.