Skip to content

Commit

Permalink
Merge pull request #24 from kefniark/feature/upgrade
Browse files Browse the repository at this point in the history
Fix multi thread issue
  • Loading branch information
kefniark committed Feb 22, 2018
2 parents 9cfa844 + bc7226b commit ef417c7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Assets/Scripts/Scanner/Scanner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ public void Scan(Action<string, string> callback)
#if !UNITY_WEBGL
if (Settings.ScannerBackgroundThread)
{
if (CodeScannerThread != null)
{
Stop(true);
}

decodeInterrupted = false;
CodeScannerThread = new Thread(ThreadDecodeQR);
CodeScannerThread.Start();
Expand Down Expand Up @@ -124,6 +129,7 @@ private void Stop(bool forced)
{
decodeInterrupted = true;
CodeScannerThread.Join();
CodeScannerThread = null;
}
#endif

Expand Down

0 comments on commit ef417c7

Please sign in to comment.