示例#1
0
void QueueManager::SetStatus(QueueManagerStatus status)
{
    QMutexLocker locker(&m_mutexStatus);
    if (m_status == status)
    {
        Logger::Log(DEBUG, "QueueManager SetStatus: no change");
        return;
    }

    m_status = status;
    locker.unlock();

    Logger::Log(INFO, "Queue Manager : %s", qPrintable(StatusToStr(status)));

    // notify engine & its clients of status change :
    emit StatusUpdate(StatusToStr(status));
}
示例#2
0
void IOEvent::OnEventWrapper(Epoller* p){
    do{
        //set processing
        int pre_mask =
                __sync_lock_test_and_set(&_events, EVENT_PROCESSING);

        assert(pre_mask&EVENT_PENDING);

        TRACE(GetStatusName()<<",pre_mask:"<<StatusToStr(pre_mask));

        this->OnEvent(p, pre_mask);

        // if not set events when process, set events to 0
    }while(!__sync_bool_compare_and_swap (&_events, EVENT_PROCESSING,0) );

    ReleaseRef();
}
示例#3
0
文件: PS_DLG.C 项目: chrisoldwood/DOS
/******************************************************************************
** Update the info about the print server and printer.
*/
void UpdatePSInfo(void)
{
     NWCCODE   wRetVal;                      /* NW return code. */
     int       iPrinterID;                   /* Printer servicing the queue. */
     WORD      wSPXConnID;                   /* Server SPX connection ID. */
     BYTE      uStatus;                      /* Printer status. */
     BYTE      uProbCode;                    /* Trouble code. */
     BYTE      bActive;                      /* Active flag. */
     BYTE      uMode;                        /* Service mode. */
     WORD      wForm;                        /* Mounted/Job form. */
     char      ServName[50];                 /* Server name. */
     char      QueueName[50];                /* Print queue name. */
     char      JobTitle[50];                 /* Job description. */
     WORD      wJobID;                       /* Job ID. */
     WORD      wCopiesReq, wCopiesDone;      /* Number of copies requested/done. */
     ULONG     lJobSize, lBytesSent;         /* Job size/bytes sent. */
     ULONG     lTotal, lTotalSent;           /* Total job size/bytes sent. */
     BYTE      bTabs;                        /* Expand tabs? */
     int       iLoop, iBlocks;               /* Graph counter. */
     
     /* Get the printer servicing the queue. */
     iPrinterID = GetQueuesPrinter(iIndex, pQueue);
     if (iPrinterID == -1)
     {
          /* Show no printer attached. */
          strcpy(PrinterName, "(none connected)");

          /* Blank other fields. */
          strcpy(PrinterName, "");
          strcpy(FormName, "");
          strcpy(Status, "");
          strcpy(CopiesReq, "");
          strcpy(CopiesDone, "");
          strcpy(CopySize, "");
          strcpy(BytesSent, "");
          strcpy(CopyBar, Graph);
          strcpy(TotalBar, Graph);
          
          /* Set dialog style. */
          ServerDlg.fFlags = DF_STATIC | DF_TIMER;   
     }
     else
     {
          /* Get the SPX connection ID. */
          wSPXConnID = GetPSSPXConn(iIndex);
     
          /* Get printer stats. */
          wRetVal = NWPSComGetPrinterStatus(wSPXConnID, (WORD)iPrinterID, (BYTE NWFAR*) &uStatus, 
               (BYTE NWFAR*) &uProbCode, (BYTE NWFAR*) &bActive, (BYTE NWFAR*) &uMode,
               (WORD NWFAR*) &wForm, (char NWFAR*) FormName, (char NWFAR*) PrinterName);

          /* Get form. */
          sprintf(FormName, "%d", wForm);
          
          /* Check status. */
          if (bActive)
          {
               /* Show status. */
               if (uProbCode)
                    strcpy(Status, TroubleToStr(uProbCode));
               else
                    strcpy(Status, StatusToStr(uStatus));

               /* Set dialog style. */
               ServerDlg.fFlags = DF_STATIC | DF_TIMER;
               
               wRetVal = NWPSComGetPrintJobStatus(wSPXConnID, (WORD)iPrinterID,
                    (char NWFAR*) ServName, (char NWFAR*) QueueName, (WORD NWFAR*) &wJobID,
                    (char NWFAR*) JobTitle, (WORD NWFAR*) &wCopiesReq, (DWORD NWFAR*) &lJobSize,
                    (WORD NWFAR*) &wCopiesDone, (DWORD NWFAR*) &lBytesSent, (WORD NWFAR*) &wForm,
                    (BYTE NWFAR*) &bTabs);
               
               /* Set copies requested. */
               sprintf(CopiesReq, "%d", wCopiesReq);

               /* Set copies done/current. */
               sprintf(CopiesDone, "%d", wCopiesDone);

               /* Set job size. */
               sprintf(CopySize, "%ld", lJobSize);

               /* Set bytes sent. */
               sprintf(BytesSent, "%ld", lBytesSent);

               /* Create basic copy graph. */
               strcpy(CopyBar, Graph);
               
               /* Calculate bytes sent. */
               iBlocks = (int) ((lBytesSent << 5) / lJobSize);
               
               /* Show done. */
               for (iLoop=0; iLoop < iBlocks; iLoop++)
                    CopyBar[iLoop] = Block;

               /* Check job size (1MB). */
               if (lJobSize > 1000000L)
               {
                    /* Knobble sizes to stop overflow. */
                    lJobSize   >>= 7;
                    lBytesSent >>= 7;
               }
               
               /* Calculate total job size and bytes sent. */
               lTotal     = lJobSize * wCopiesReq;
               lTotalSent = (lJobSize * (wCopiesDone)) + lBytesSent;
               
               /* Create basic total graph. */
               strcpy(TotalBar, Graph);
               
               /* Calculate total done. */
               iBlocks = (int) ((lTotalSent << 5) / lTotal);
               
               /* Create graph. */
               for (iLoop=0; iLoop < iBlocks; iLoop++)
                    TotalBar[iLoop] = Block;
          }
          else /* Not active. */
          {
               /* Show status. */
               if (uProbCode)
示例#4
0
QString QueueManager::StatusStr()
{
    QMutexLocker locker(&m_mutexStatus);
    return StatusToStr(m_status);
}
示例#5
0
std::string IOEvent::GetStatusName(){
    char name[64]={0};
    snprintf(name,sizeof(name),"%d_%s",_fd,StatusToStr(_events).c_str());
    return std::string(name);
}