0
Grand Central Dispatch API是否允許執行上下文(線程)在運行時查詢任何線程特定的狀態?具體來說,是否有與OpenMP調用相同的GCD omp_get_thread_num()
?Grand Central Dispatch等效於omp_get_thread_num
Grand Central Dispatch API是否允許執行上下文(線程)在運行時查詢任何線程特定的狀態?具體來說,是否有與OpenMP調用相同的GCD omp_get_thread_num()
?Grand Central Dispatch等效於omp_get_thread_num
如果您想對一堆事物(如地圖操作)執行n次操作,可以使用dispatch_apply
。
dispatch_apply(10, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, NULL), ^(size_t index) {
void * my_thing = my_tings[index];
// ...
});