NsThread list task
Hello everyone I need to accomplish this (iphone/objective-c) :
- I have my thread it has to pe开发者_JAVA技巧rform the operations.
- the main thread assigns a new task to my thread (the tasks are always the same).
- each operation has its own id.
the main thread when assigning a task to my thread, must check whether this operation is an operation that could stop (cancel) that is running on my thread (if new task id = task running id).
Do you have any suggestions on how I might accomplish this?
- for this work...NSThread or NSOperation?
- I need a shared data structure and synchronized to the operations?
- how can I handle the abort the transaction without having to kill the thread? Thanks
Take a look at NSOperation
and NSOperationQueue
.
精彩评论