tidev / ti.worker

Use Multi-Threading / Worker Threads in Appcelerator Titanium.
Other
96 stars 27 forks source link

Stuck during JS processing #20

Open dr0-dev opened 4 years ago

dr0-dev commented 4 years ago

I found a problem after repeating my background process several times during a normal use. (The user click on a ListView, the bg process starts/ends, a new window is open)

The module gets stuck right after

[_bridge evalJSWithoutResult:@"TiWorkerStart__();"]; in the booted method:

- (void)booted:(id)bridge
{
  // this callback is called when the thread is up and running
  dispatch_async(_serialQueue, ^{
    _booted = YES;
    NSLog(@"[INFO] Worker %@ (0x%X) is running", [_selfProxy url], self);
    [_selfProxy setExecutionContext:_bridge];
    [[NSFileManager defaultManager] removeItemAtPath:_tempFile error:nil];
  });

  // start our JS processing
  dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
      [_bridge evalJSWithoutResult:@"TiWorkerStart__();"]; // STUCK HERE
  });
}

usually the postMessage method is what happens after, but not in some cases.