📄 step9.cpp
字号:
/*
* Step9:
* Program exit by killing main thread, check also stack unwinding.
*/
#include <iostream.h>
#include <stdlib.h>
#include "PiAPI.h"
#include "TestOS.h"
static int iStackUnwound = 0;
class Dummy
{
public:
Dummy()
{
cout << "Dummy constructed" << endl;
};
~Dummy()
{
cout << "Dummy destructed" << endl;
iStackUnwound = 1;
};
};
int iRet;
void foo()
{
Dummy d;
iRet = 0;
PIThread_terminate( PIThread_getMain(), 37 );
FAILED(1);
}
void Step9()
{
iRet = -1;
foo();
}
int main()
{
if ( PIPlatform_enter( "Dummy", PIPLATFORM_VERSION_1_0, Step9 ) )
{
cout << "Platform_enter() failed." << endl;
FAILED(99);
exit( 1 );
};
if ( !iStackUnwound )
{ FAILED(2); return -1; };
OK;
return iRet;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -