0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

GCDメモ dispatch_queue_set_specific

Posted at

dispatch queueにキー、バリューデータを関連付ける。

keyvalue
void
dispatch_queue_set_specific(dispatch_queue_t queue, const void *key,
	void *context, dispatch_function_t destructor);
  • セットしたcontextはdispatch_queue_get_specificで取得できる。
  • デストラクタは新しいコンテキストが同じキーでセットされたとき、またはキューの参照がすべてリリースされた後に、"default priority global concurrent queue"をもつコンテキストによって呼び出される。

queue

  • セットするqueueを指定する。NULLは許されない。

key

  • keyはコンテキスにセットするキーであり、典型的にはサブシステムに固有な静的変数へのポインタ。
  • keyはポインタとしてのみ比較される。
  • 直接に文字定数のポインタを使用するのは推奨されない。
  • NULLは無効

context

  •  キーに関連するデータ、NULLでも良い。
  • オブジェクトについての新しいサブシステム固有のコンテキスト。NULLでもよい。

destructor

  • デストラクタ関数へのポインタ。ここでcontextのリリースをすることができる。NULLでも良い。コンテキストがNULLのときは無視される。
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?