philosopherthread.h

来自「Visual dsp++ VDK应用实例」· C头文件 代码 · 共 53 行

H
53
字号
/* =============================================================================
 *
 *  Description: This is a C++ to C Thread Header file for Thread PhilosopherThread
 *
 * -----------------------------------------------------------------------------
 *  Comments: 
 *
 * ===========================================================================*/

#ifndef _PhilosopherThread_H_
#define _PhilosopherThread_H_

#include "VDK.h"

#ifdef __ECC__  /* for C/C++ access */
#ifdef __cplusplus
extern "C" void PhilosopherThread_InitFunction(void**, VDK::Thread::ThreadCreationBlock *);
#else
extern "C" void PhilosopherThread_InitFunction(void**, VDK_ThreadCreationBlock *);
#endif
extern "C" void PhilosopherThread_DestroyFunction(void**);
extern "C" int  PhilosopherThread_ErrorFunction(void**);
extern "C" void PhilosopherThread_RunFunction(void**);
#endif /* __ECC__ */

#ifdef __cplusplus
#include <new>

class PhilosopherThread_Wrapper : public VDK::Thread
{
public:
	PhilosopherThread_Wrapper(VDK::Thread::ThreadCreationBlock &t)
		: VDK::Thread(t)
	{ PhilosopherThread_InitFunction(&m_DataPtr, &t); }

	~PhilosopherThread_Wrapper()
	{ PhilosopherThread_DestroyFunction(&m_DataPtr); }

	int ErrorHandler()
	{ return PhilosopherThread_ErrorFunction(&m_DataPtr); }

	void Run()
	{ PhilosopherThread_RunFunction(&m_DataPtr); }

	static VDK::Thread* Create(VDK::Thread::ThreadCreationBlock &t)
	{ return new (t) PhilosopherThread_Wrapper(t); }
};

#endif /* __cplusplus */
#endif /* _PhilosopherThread_H_ */

/* ========================================================================== */

⌨️ 快捷键说明

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