⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 thread_000.cpp

📁 HIP 硬件设备管理标准接口
💻 CPP
字号:
/* * Copyright (c) 2004 by FORCE Computers. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  This * file and program are licensed under a BSD style license.  See * the Copying file included with the OpenHPI distribution for * full licensing terms. * * Authors: *     Thomas Kanngieser <thomas.kanngieser@fci.com> */#include "thread.h"#include "test.h"#include "ipmi_utils.h"#define dMagic 0x47130815class cThreadTest : public cThread, public cThreadLock, public cThreadLockRw{public:  cThreadTest()    : m_magic( dMagic )  {}    unsigned int m_magic;protected:  virtual void *Run();};void *cThreadTest::Run(){  cTime tn = cTime::Now();  tn += 1000;  cThreadTest *thread = (cThreadTest *)cThread::GetThread();  Test( thread == this );  Test( thread->m_magic == dMagic );  while( tn > cTime::Now() )       usleep( 100000 );  return 0;}intmain(){  cThread *mt = cThread::GetThread();  Test( mt );  Test( mt->IsRunning() );  Test( mt->IsMain() );  cThreadTest thread;  Test( thread.Start() );  Test( thread.IsRunning() );  while( thread.IsRunning() )       usleep( 100000 );  return TestResult();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -