// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF // ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // // Copyright (c) Microsoft Corporation. All rights reserved // FUTURE: Unused currently #pragma once class RdcThread { public: RdcThread(); ~RdcThread(); template bool AddJob ( JobTypeT &job, UserDataT *userData ) { return AddJobImpl ( RunJobImpl, static_cast ( &job ), static_cast ( userData ) ); } private: typedef void ( *RunFnT ) ( void *jobData, void *userData ); struct JobInfo { void ( *runFn ) ( void *jobData, void *userData ); void *jobData; void *userData; }; std::vector m_PendingJobs; bool AddJobImpl ( RunFnT runFn, // A pointer to a RunJobImpl() void *jobData, void *userData ); template static void RunJobImpl ( void *voidJob, void *voidUserData ) { // Cast (void*) back to the correct data type // and dispatch JobTypeT * job = reinterpret_castvoidJob; UserDataT *userData = reinterpret_castvoidUserData; job->Run ( userData ); } };