⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 athread.c

📁 adios在windows的实现
💻 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 + -