void CIBATaskPane::OnClickTask(int nGroupNumber, int nTaskNumber, UINT uiCommandID, DWORD dwUserData) { if (IDM_AGENT == uiCommandID) { if (m_bShowUseList) { SetTaskName(m_nUserInfoGroup, m_nUserInfoList, _T("")); SetTaskName(m_nUserInfoGroup, m_nUserInfoButton, _T("上机记录>>")); } else { CWaitCursor wait; CString strTmp(QueryConsume()); SetTaskName(m_nUserInfoGroup, m_nUserInfoList, strTmp); SetTaskName(m_nUserInfoGroup, m_nUserInfoButton, _T("<<上机记录")); } RecalcLayout(); m_bShowUseList = !m_bShowUseList; } }
void InitializeGameProcess::Main() { FILE* fp = fopen("GameData.dat","rb"); if(fp) { fseek(fp,0,SEEK_END); size_t sz = ftell(fp); fseek(fp,0,SEEK_SET); SetTaskName(FormatString("Reading %lu bytes (1/2)",sz)); ByteStream* Data = new ByteStream(); for(i32 i = 0;i < sz;i++) { Data->WriteByte(getc(fp)); SetProgress(((Scalar)i) / ((Scalar)sz)); } fclose(fp); SetTaskName("Deserializing data (2/2)"); SetProgress(0.0f); } m_Completed = true; }
void CIBATaskPane::ShowUserInfo(CString strContent) { if (m_nUserInfoTask == -1) { RemoveAllTasks(m_nUserInfoGroup); m_nUserInfoTask = AddLabel(m_nUserInfoGroup, strContent); AddSeparator(m_nUserInfoGroup); m_nUserInfoButton = AddTask(m_nUserInfoGroup, _T("上机记录>>"), -1, IDM_AGENT); AddSeparator(m_nUserInfoGroup); m_nUserInfoList = AddLabel(m_nUserInfoGroup, _T("")); } else { SetTaskName(m_nUserInfoGroup, m_nUserInfoTask, strContent); SetTaskName(m_nUserInfoGroup, m_nUserInfoList, _T("")); SetTaskName(m_nUserInfoGroup, m_nUserInfoButton, _T("上机记录>>")); m_bShowUseList = FALSE; } RecalcLayout(); }
CRpcServerUnixConnection(CRpcUnixServer* inServerPtr) : CRpcUnixConnection(TRUE) , mServerPtr(inServerPtr) { char theTaskName[128]; sprintf(theTaskName,"CRpcServerUnixConnection%p",this); SetTaskName(theTaskName); TRACE(" nsTgmRpcCom::CRpcServerUnixConnection() this:%p\n",this); mIsConnected = TRUE; }
/** \brief Wrap thread start routine * * \b os_startRoutineWrapper wraps a threads starting routine. * before calling the user routine, it sets the threads name * in the context of the thread. With \b pthread_getspecific, * the name can be retreived for different purposes. */ static void * os_startRoutineWrapper ( void *threadContext) { os_threadContext *context = threadContext; void *resultValue; os_threadId id; resultValue = NULL; #ifdef INTEGRITY SetTaskName(CurrentTask(), context->threadName, strlen(context->threadName)); #else #ifndef OS_HAS_NO_SET_NAME_PRCTL prctl(PR_SET_NAME, context->threadName); #endif #endif /* store the thread name with the thread via thread specific data */ pthread_setspecific (os_threadNameKey, context->threadName); /* allocate an array to store thread private memory references */ os_threadMemInit (); id = pthread_self(); /* Call the start callback */ if (os_threadCBs.startCb(id, os_threadCBs.startArg) == 0) { /* Call the user routine */ resultValue = context->startRoutine (context->arguments); } os_threadCBs.stopCb(id, os_threadCBs.stopArg); #if !LITE os_report_stack_free(); os_reportClearApiInfo(); #endif /* Free the thread context resources, arguments is responsibility */ /* for the caller of os_procCreate */ os_free (context->threadName); os_free (context); /* deallocate the array to store thread private memory references */ os_threadMemExit (); /* return the result of the user routine */ return resultValue; }
void CProgressDlg::RestartTask(LPCTSTR pszTask, size_t nTotal /* = -1 */) { SetTaskName(pszTask); ResetProgress(static_cast<int>(nTotal)); ShowWindow(SW_SHOWDEFAULT); }
ThreadTask::ThreadTask( UINT32 unPriority , char * pTaskName /*= "UnknownName"*/ , BOOL bInStack /*=TRUE*/ ) : m_unPriority(unPriority) , m_bInStack(bInStack) { SetTaskName(pTaskName); }