Exemple #1
0
/*
 * Manual page at process.def
 */
INT16 CGEN_PUBLIC CProcess::Wait()
{
  const SMic* pMic    = NULL;                                                   // Method invocation context of Wait()
  CFunction*  iCaller = NULL;                                                   // Function instance calling Wait()

  // Validate and initialize                                                    // ------------------------------------
  if (!((m_nState & PRC_RUNNING)|PRC_COMPLETE))                                 // Not running
    return IERROR(this,PRC_CANTWAIT,"not started",0,0);                         //   Forget it
  if (!(pMic = CDlpObject_MicGet(_this))) return -1;                            // Get method invocation context
  iCaller = (CFunction*)CDlpObject_OfKind("function",pMic->iCaller);            // Get calling CFunction
  if (!iCaller) return -1;                                                      // Must be a function!

  // Wait for job to be completed                                               // ------------------------------------
#ifdef USE_FORK
  if(!m_hThread && m_hPid){                                                     // If there is a child process by fork >>
    waitpid(m_hPid,NULL,0);                                                     //   Wait for child process
    m_nState &= ~PRC_RUNNING;                                                   //   Clear running flag
    m_nState |= PRC_COMPLETE;                                                   //   Set completed flag
  }else                                                                         // <<
#endif
  dlp_join_thread(m_hThread);                                                   // Wait for the watcher thread to end
  ReceiveData();                                                                // Receive transfer data

  // Aftermath                                                                  // ------------------------------------
  if (m_iDto)                                                                   // This job was a function call
    Unmarshal(m_iDto,iCaller);                                                  //   Unmarshal transfer data to caller
  else                                                                          // This job was a program call
    MIC_PUT_N(m_nRetVal);                                                       //   Push process return value

  return O_K;                                                                   // Ok
}
Exemple #2
0
INT16 CDlpFile_OnGetlen(CDlpObject* __this)
/* DO NOT CALL THIS FUNCTION FROM C++ SCOPE.     */
/* IT MAY INTERFERE WITH THE INTERPRETER SESSION */
{
	INT16 __nErr    = O_K;
	INT32  __nErrCnt = 0;
	GET_THIS_VIRTUAL_RV(CDlpFile,NOT_EXEC);
	MIC_CHECK;
	__nErrCnt = CDlpObject_GetErrorCount();
	if (CDlpObject_GetErrorCount()>__nErrCnt) return NOT_EXEC;
	MIC_PUT_N(CDlpFile_Getlen(_this));
	return __nErr;
}
Exemple #3
0
INT16 CFsttools_OnGetlogprob(CDlpObject* __this)
/* DO NOT CALL THIS FUNCTION FROM C++ SCOPE.     */
/* IT MAY INTERFERE WITH THE INTERPRETER SESSION */
{
    INT16 __nErr    = O_K;
    INT32  __nErrCnt = 0;
    INT16 nSeqLen;
    data* idSeq;
    INT64 nUnit;
    fst* itFst;
    GET_THIS_VIRTUAL_RV(CFsttools,NOT_EXEC);
    MIC_CHECK;
    __nErrCnt = CDlpObject_GetErrorCount();
    itFst = MIC_GET_I_EX(itFst,fst,1,1);
    nUnit = (INT64)MIC_GET_N(2,0);
    idSeq = MIC_GET_I_EX(idSeq,data,3,2);
    nSeqLen = (INT16)MIC_GET_N(4,1);
    if (CDlpObject_GetErrorCount()>__nErrCnt) return NOT_EXEC;
    MIC_PUT_N(CFsttools_Getlogprob(_this, nSeqLen, idSeq, nUnit, itFst));
    return __nErr;
}