Tuesday, 15 September 2015

ios - Stopping main thread execution -



ios - Stopping main thread execution -

my question simple:

i want stop main thread current execution after set timer, can done?

for example:

mainthread running:

while(true) { i++; }

i want stop after 10 secs go on next command.

notice, main thread doing cpu work, not sleeping...

more specific, problem is:

my main thread running javascript might buggy , run forever, calling method must done in main thread.

i want stop main thread executing javascript after 10 secs (and move next command, or grab block), presume if hasn't finished after 10 secs means javascript code buggy , don't want go on running.

[webview stringbyevaluatingjavascriptfromstring:<some java script may take forever>];

this problem, can't interrupt main thread, can send message message queue main thread busy cpu work.

can done?

ios multithreading

No comments:

Post a Comment