📄 step7.cpp
字号:
/*
* 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -