- onmiThread提供了跨平台的thread底层封装,用户在使用时可以完全不用考虑系统间的差异。本文是关于关于omniThread使用的一个简单示例程序,程序中我们定义了自己的线程类myThread,详细代码如下:
myThread.h
#if !defined(AFX_MYTHREAD_H__B109AC55_F90B_4BD3_A902_60C090896C15__INCLUDED_)
#define AFX_MYTHREAD_H__B109AC55_F90B_4BD3_A902_60C090896C15__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "omniORB4/CORBA.h"
#include "omniThread.h"
class myThread
{
public:
myThread();
virtual ~myThread();
void start();
unsigned int getId() const;
void terminate();
private:
omni_thread* m_pThread;
};
#endif // !defined(AFX_MYTHREAD_H__B109AC55_F90B_4BD3_A902_60C090896C15__INCLUDED_)
myThread.cpp
// myThread.cpp: implementation of the myThread class.
//
//
#include "stdafx.h"<