Exemple #1
0
// The "choose me" signal from a candidate.
void
ArbitMgr::doChoose(const Uint32* theData)
{
    ArbitSignal aSignal;
    aSignal.init(GSN_ARBIT_CHOOSEREQ, theData);
    sendSignalToThread(aSignal);
}
Exemple #2
0
// Start arbitrator thread.  This is kernel request.
// First stop any previous thread since it is a left-over
// which was never used and which now has wrong ticket.
void
ArbitMgr::doStart(const Uint32* theData)
{
  ArbitSignal aSignal;
  NdbMutex_Lock(theThreadMutex);
  if (theThread != NULL) {
    aSignal.init(GSN_ARBIT_STOPORD, NULL);
    aSignal.data.code = StopRestart;
    sendSignalToThread(aSignal);
    void* value;
    NdbThread_WaitFor(theThread, &value);
    NdbThread_Destroy(&theThread);
    theState = StateInit;
    theInputFull = false;
  }
  aSignal.init(GSN_ARBIT_STARTREQ, theData);
  sendSignalToThread(aSignal);
  theThread = NdbThread_Create(
    runArbitMgr_C, (void**)this, 32768, "ndb_arbitmgr",
    NDB_THREAD_PRIO_HIGH);
  NdbMutex_Unlock(theThreadMutex);
}
Exemple #3
0
// Stop arbitrator thread via stop signal from the kernel
// or when exiting API program.
void
ArbitMgr::doStop(const Uint32* theData)
{
    DBUG_ENTER("ArbitMgr::doStop");
    ArbitSignal aSignal;
    NdbMutex_Lock(theThreadMutex);
    if (theThread != NULL) {
        aSignal.init(GSN_ARBIT_STOPORD, theData);
        if (theData == 0) {
            aSignal.data.code = StopExit;
        } else {
            aSignal.data.code = StopRequest;
        }
        sendSignalToThread(aSignal);
        void* value;
        NdbThread_WaitFor(theThread, &value);
        NdbThread_Destroy(&theThread);
        theState = StateInit;
    }
    NdbMutex_Unlock(theThreadMutex);
    DBUG_VOID_RETURN;
}