mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
*** empty log message ***
This commit is contained in:
parent
27d8cde394
commit
3677bc15ad
@ -1,51 +0,0 @@
|
|||||||
// threader.cpp : Defines the entry point for the console application.
|
|
||||||
//
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "WinThreads.h"
|
|
||||||
#include "ThreadWorker.h"
|
|
||||||
|
|
||||||
using namespace SourceMod;
|
|
||||||
|
|
||||||
unsigned int g_count = 0;
|
|
||||||
|
|
||||||
class Sai : public IThread
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void RunThread(IThreadHandle *pHandle)
|
|
||||||
{
|
|
||||||
printf("[%02d] Ran at: %d\n", ++g_count, GetTickCount());
|
|
||||||
}
|
|
||||||
virtual void OnTerminate(IThreadHandle *pHandle, bool cancel)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
WinThreader kWt;
|
|
||||||
ThreadWorker kWorker(&kWt, 0);
|
|
||||||
Sai sai;
|
|
||||||
|
|
||||||
printf("Queueing three threads:\n");
|
|
||||||
kWorker.Start();
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
printf("Waiting 10 seconds...\n");
|
|
||||||
Sleep(10000);
|
|
||||||
printf("Done waiting, adding 5 threads...\n");
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
kWorker.MakeThread(&sai);
|
|
||||||
printf("Pausing...\n");
|
|
||||||
kWorker.Pause();
|
|
||||||
printf("Sleeping for 10 seconds... \n");
|
|
||||||
Sleep(10000);
|
|
||||||
printf("Unpausing... \n");
|
|
||||||
kWorker.Unpause();
|
|
||||||
printf("Sleeping for 10 seconds... \n");
|
|
||||||
Sleep(10000);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user