discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libdispatch: blocks on main queue does not execute


From: Lundberg, Johannes
Subject: libdispatch: blocks on main queue does not execute
Date: Fri, 27 Dec 2013 15:27:53 +0900

Hi

I'm a big fan of dispatch and blocks. For iOS development I often use the pattern

dispatch_async(dispatch_get_global_queue(0,0), ^{
  // do some time consuming task
  dispatch_async(dispatch_get_main_queue(), ^{
    // update ui
  });
});

However, this does not work on GNUstep/FreeBSD.
Blocks put on global queues execute fine. Blocks on main queue does not execute.

Not even
  dispatch_async(dispatch_get_main_queue(), ^{
    NSLog(@"Test..");
  });
from main thread/queue works.

Reading the documentation there seem to be a
dispatch_main()
call required to execute blocks on main queue.
If I add this call after the above the blocks on the main queue executes just fine, however, the code freezes there.
As it says:
* This function "parks" the main thread and waits for blocks to be submitted
 * to the main queue. This function never returns.
 * Applications that call NSApplicationMain() or CFRunLoopRun() on the
 * main thread do not need to call dispatch_main().

This makes me think that there is something missing in GNUstep compared to Cocoa's NSRunLoop to enable this.

Anyone have any idea about this?

--
Johannes Lundberg


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
秘密保持について:この電子メールは、名宛人に送信したものであり、秘匿特権の対象となる情報を含んでいます。
もし、名宛人以外の方が受信された場合、このメールの破棄、およびこのメールに関する一切の開示、
複写、配布、その他の利用、または記載内容に基づくいかなる行動もされないようお願い申し上げます。
---
CONFIDENTIALITY NOTE: The information in this email is confidential
and intended solely for the addressee.
Disclosure, copying, distribution or any other action of use of this
email by person other than intended recipient, is prohibited.
If you are not the intended recipient and have received this email in
error, please destroy the original message.
reply via email to

[Prev in Thread] Current Thread [Next in Thread]