IOS Javascript Workers High CPU After Terminate()
I have a complex javascript function which could take 1 second, or many minutes sending an answer. So I created a Worker which is working, I'm calling this function from my UIWebVi
Solution 1:
the easiest way to terminate the worker (and be sure of it) would be to inject a boolean expression to cause the code to "exception out" of its main loop (or even return gracefully if there is only 1 or 2 bottlenecks in the code.). and you can perform any required cleanup in a catch block prior to letting it exit naturally.
I personally hate ending threads with functions such as terminate or kill because it can leave things in a undefined state
The call to terminate may get ignored or enqueued for later simply because the worker is using all the resources it can leaving no time for message processing.
Post a Comment for "IOS Javascript Workers High CPU After Terminate()"