You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: macos.rs
    path of file: ./repos/nih-plug/src/event_loop
    
    the code of the file until where you have to start completion: //! An event loop implementation for macOS.

use core_foundation::base::kCFAllocatorDefault;
use core_foundation::runloop::{
    kCFRunLoopCommonModes, CFRunLoopAddSource, CFRunLoopGetMain, CFRunLoopRemoveSource,
    CFRunLoopSourceContext, CFRunLoopSourceCreate, CFRunLoopSourceInvalidate, CFRunLoopSourceRef,
    CFRunLoopSourceSignal, CFRunLoopWakeUp,
};
use crossbeam::channel::{self, Receiver, Sender};
use objc::{class, msg_send, sel,
    
    fn schedule_gui(&self, task: T) -> bool {
        if self.is_main_thread() {
            match self.executor.upgrade() {
                Some(executor) => executor.execute(task, true),
                None => nih_debug_assert_failure!("GUI task posted after the executor was dropped"),
            }

            true
        } else {
            // Only signal the main thread callback to be called if the task was added to the queue.
            let success = self.main_thread_sender.try_send(task).is_ok();
            if success {
                unsafe {
                    CFRunLoopSourceSignal(self.loop_source.0);
                    CFRunLoopWakeUp(CFRunLoopGetMain());
                }
            }

            success
        }
    }