开发者

Raise an exception on another thread in iOS/Objective-C?

开发者 https://www.devze.com 2023-03-29 07:59 出处:网络
开发者_开发问答Is there a way to raise an exception on another thread in iOS/Objective-C? What I am trying to do is create something like Java\'s Thread.interrupt() and InterruptedException do (see J

开发者_开发问答Is there a way to raise an exception on another thread in iOS/Objective-C?

What I am trying to do is create something like Java's Thread.interrupt() and InterruptedException do (see Java API) ? This exception is raised on a thread when someone calls the thread's interrupt method, thus allowing another thread to signal a proposed termination.


Is -[NSThread cancel] what you're looking for? It doesn't raise an exception, but it allows another thread to signal a proposed termination.

0

精彩评论

暂无评论...
验证码 换一张
取 消