示例#1
0
 public static NSObject observeWillExit(NSThread object, final VoidBlock1<NSThread> block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           WillExitNotification(),
           object,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.invoke((NSThread) a.getObject());
             }
           });
 }
示例#2
0
 public static NSObject observeDidBecomeSingleThreaded(final Runnable block) {
   return NSNotificationCenter.getDefaultCenter()
       .addObserver(
           DidBecomeSingleThreadedNotification(),
           null,
           NSOperationQueue.getMainQueue(),
           new VoidBlock1<NSNotification>() {
             @Override
             public void invoke(NSNotification a) {
               block.run();
             }
           });
 }