step7.cpp

来自「mini http server,可以集成嵌入到程序中,实现简单的web功能」· C++ 代码 · 共 43 行

CPP
43
字号

/*
 * Step6:
 * Deadlock detection.
 * Detect deadlock from suspension.
 */

#include <iostream.h>
#include <stdlib.h>

#include "PiAPI.h"
#include "TestOS.h"

int iRet;
void Step7()
{
	iRet = -1;

	/* ---
	Do deadlock by suspending the current thread. There is only one
	thread in this program
	--- */
	if (! ( PIThread_suspend( PIThread_getCurrent() )==PIAPI_ERROR &&
		PIPlatform_getLastError() == PIAPI_DEADLOCK ) )
		{ FAILED(1); return; };

	OK;
	iRet = 0;
}

int main()
{
	if ( PIPlatform_enter( "dummy", PIPLATFORM_VERSION_1_0, Step7 ) )
		{
		cout << "Platform_enter() failed." << endl;
		FAILED(99);
		exit( 1 );
		};

	return iRet;
}

⌨️ 快捷键说明

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