File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ package dispatch
99// void Dispatch_Release(void* queue);
1010// void Dispatch_Async(void* queue, uintptr_t task);
1111// void Dispatch_Sync(void* queue, uintptr_t task);
12+ // void* Dispatch_Create_Queue(const char* label, void* attr);
1213import "C"
1314import (
1415 "math"
@@ -73,3 +74,12 @@ func runQueueTask(p C.uintptr_t) {
7374 task ()
7475 h .Delete ()
7576}
77+
78+ // Creates a new dispatch queue to which blocks can be submitted.
79+ //
80+ // [Full Topic]: https://developer.apple.com/documentation/dispatch/1453030-dispatch_queue_create?language=objc
81+ func CreateQueue (label string , attr uintptr ) Queue {
82+ cLabel := C .CString (label )
83+ p := C .Dispatch_Create_Queue (cLabel , unsafe .Pointer (attr ))
84+ return Queue {p }
85+ }
Original file line number Diff line number Diff line change @@ -31,4 +31,9 @@ void Dispatch_Sync(void* queue, uintptr_t task) {
3131 dispatch_sync ((dispatch_queue_t )queue, ^{
3232 runQueueTask (task);
3333 });
34- }
34+ }
35+
36+ void * Dispatch_Create_Queue (const char * label, void * attr) {
37+ dispatch_queue_t queue = dispatch_queue_create (label, attr);
38+ return queue;
39+ }
You can’t perform that action at this time.
0 commit comments