Skip to content

Check if thread is running before suspending#80

Merged
Jimmacle merged 3 commits intomasterfrom
shutdown-crash-fix
Aug 22, 2017
Merged

Check if thread is running before suspending#80
Jimmacle merged 3 commits intomasterfrom
shutdown-crash-fix

Conversation

@Jimmacle
Copy link
Copy Markdown
Member

@Jimmacle Jimmacle commented Aug 22, 2017

Fixes a bug noticed in Essentials issue 8 TorchAPI/Essentials#8

@Jimmacle Jimmacle requested a review from Equinox- August 22, 2017 01:58
Comment thread Torch.Server/TorchServer.cs Outdated
{
var mainThread = MySandboxGame.Static.UpdateThread;
mainThread.Suspend();
if (mainThread.ThreadState == System.Threading.ThreadState.Running)
Copy link
Copy Markdown
Member

@Equinox- Equinox- Aug 22, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main thread could possibly be in a second state, ThreadState.WaitSleepJoin. Probably should check for that possibility. You could also consider Thread.IsAlive.

@Jimmacle Jimmacle merged commit 4cb50b5 into master Aug 22, 2017
@Jimmacle Jimmacle deleted the shutdown-crash-fix branch August 22, 2017 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants