📄 athread.c
字号:
/***************************
* AdiOS Threading Example *
* athread.c *
* 16-10-2001 *
***************************/
// Entry point and kernel API defined here
#include "..\kernapi.h"
// The second thread prototype
void * OtherThread(__int32 param);
// A semaphore
unsigned int Semaphore;
void * appmain(__int32 param)
{
// Let the world know we're coming
PrintCR("App Started, launching second thread.");
// Create out output semaphore
Semaphore = CreateSem(1);
// Launch the second thread
StartThread(&OtherThread, 0);
// Enter an infinite loop
while(1){
WaitSem(Semaphore);
Print("A");
ReleaseSem(Semaphore);
}
return 0; // Keep the compiler happy
}
// This is the second thread
void * OtherThread(__int32 param)
{
// To help with debugging.
PrintCR("Second Thread Started...");
// Enter an infinite loop
while(1){
WaitSem(Semaphore);
Print("B");
ReleaseSem(Semaphore);
}
return 0; // Keep the compiler happy
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -