Skip to content

Instantly share code, notes, and snippets.

@SammyJames
Last active September 2, 2015 03:38
Show Gist options
  • Save SammyJames/d9a4045ec1c8820d1e15 to your computer and use it in GitHub Desktop.
Save SammyJames/d9a4045ec1c8820d1e15 to your computer and use it in GitHub Desktop.
// Copyright 2015 Sammy James
#include "TaskTypes.h"
#include "Jobs/Job.h"
#include "Fibers/Fiber.h"
#include "Threads/Thread.h"
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <assert.h>
int32 main( int32 ArgC, char** ArgV )
{
Threads::Thread TestThread( "Test Thread", true );
TestThread.SetPriority( Threads::EPriority::Normal );
std::shared_ptr< Jobs::IJob > NewJob( new Jobs::Job< int32 >(
[]( int32 Test )
{
printf( "Testing: %d", Test );
},
INT_MAX ) );
std::shared_ptr< Jobs::IJob > SecondJob( new Jobs::Job< std::string >(
[]( const std::string& Arg )
{
printf( "Testing: %s", Arg.c_str() );
},
"Hello World" ) );
TestThread.AddJob( NewJob );
TestThread.AddJob( SecondJob );
TestThread.WaitForCompletion();
TestThread.RequestJoin();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment