调度源处理程序的上下文

问题描述 投票:0回答:1

在 Grand Central Dispatch 中,

dispatch_source_set_event_handler_f
有签名

void
dispatch_source_set_event_handler_f(dispatch_source_t source, void (*function)(void *));

dispatch_source_set_cancel_handler_f
有类似的签名。

什么为

function
提供了论据? 手册页似乎没有列出设置上下文的函数。

c grand-central-dispatch
1个回答
0
投票

调度源是一种调度对象,因此您可以使用

dispatch_set_context
设置上下文。

© www.soinside.com 2019 - 2024. All rights reserved.