Example #1
0
/*!
\brief Called once when the thread starts.
*/
bool JackClient::Init()
{
    /*
        Execute buffer_size callback.

        Since StartThread uses fThread.StartSync, we are sure that buffer_size callback
        is executed before StartThread returns (and then IsActive will be true).
        So no RT callback can be called at the same time.
    */
    jack_log("JackClient::kBufferSizeCallback buffer_size = %ld", GetEngineControl()->fBufferSize);
    if (fBufferSize) {
        fBufferSize(GetEngineControl()->fBufferSize, fBufferSizeArg);
    }

    // Init callback
    InitAux();

    // Setup context
    if (!jack_tls_set(JackGlobals::fRealTimeThread, this)) {
        jack_error("Failed to set thread realtime key");
    }

    // Setup RT
    if (GetEngineControl()->fRealTime) {
        set_threaded_log_function();
        SetupRealTime();
    }

    return true;
}
bool JackSocketClientChannel::Init()
{
    jack_log("JackSocketClientChannel::Init");
    fNotificationSocket = fNotificationListenSocket.Accept();
    
    // No more needed
    fNotificationListenSocket.Close();
    
    // Setup context
    if (!jack_tls_set(JackGlobals::fNotificationThread, this)) {
        jack_error("Failed to set thread notification key");
    }

    if (!fNotificationSocket) {
        jack_error("JackSocketClientChannel: cannot establish notication socket");
        return false;
    } else {
        return true;
    }
}