Difference between performSelectorInBackground and NSOperation Subclass

后端 未结 1 621
南方客
南方客 2021-01-03 06:39

I have created one testing app for running deep counter loop. I run the loop function in background thread using performSelectorInBackground and also NSOperation subclass se

1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-03 07:23

    It's likely the operation queue is keeping threads alive, waiting for new operations to appear.

    You have to remember that the operation queue is designed to work efficiently with many operations, so creating and destroying threads for each operation is going to hurt performance. So what you are seeing is probably just the way the queue is designed to work by keeping a pool of threads alive.

    Basically, as long as you are using the operation queue properly and according to the documentation I wouldn't worry about it.

    0 讨论(0)
提交回复
热议问题