0

I'm trying to run some NSWindow functions from another thread on OSX. I am doing this via ctypes so need to find the library files.

dispatch_sync I found in libc.dylib but I can't find dispatch_get_main_queue, does anyone know the library that is in? Is it not in libc? I thought to use this based on here: Objective C Multi thread NSWindow alternative?

I also couldn't find the docs of the types used on opensource.apple can someone also help me find that for this Dispatch module.

Community
  • 1
  • 1
Noitidart
  • 35,443
  • 37
  • 154
  • 323

1 Answers1

1

dispatch_get_main_queue() is an inline function, so it doesn't end up in any library. It's compiled into every [Objective-]C/C++ file that uses it.

It compiles down to just (dispatch_queue_t)&_dispatch_main_q, more or less. That is, there's a global variable _dispatch_main_q and dispatch_get_main_queue() just returns its address, type cast to dispatch_queue_t.

On my 10.9.5 system, _dispatch_main_q is exported by /usr/lib/system/libdispatch.dylib.

Ken Thomases
  • 88,520
  • 7
  • 116
  • 154
  • Thanks so much Ken for such a fast answer! I was struggling with this sucker for like 12 hours! On and off :P – Noitidart Jul 26 '15 at 15:48