Moved ThreadPool class to separate files.
git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@894 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
parent
c48d2f7a84
commit
1cc348d6e2
2 changed files with 390 additions and 81 deletions
|
@ -88,87 +88,6 @@ using namespace Loki;
|
|||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
//class Thread
|
||||
//{
|
||||
//public:
|
||||
//
|
||||
// typedef void * ( * CallFunction )( void * );
|
||||
//
|
||||
// Thread( CallFunction func, void * parm )
|
||||
// : pthread_()
|
||||
// , func_( func )
|
||||
// , parm_( parm )
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// int Start( void )
|
||||
// {
|
||||
// return LOKI_pthread_create( &pthread_, nullptr, func_, parm_ );
|
||||
// }
|
||||
//
|
||||
// int WaitForThread( void ) const
|
||||
// {
|
||||
// return LOKI_pthread_join( pthread_ );
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
// LOKI_pthread_t pthread_;
|
||||
// CallFunction func_;
|
||||
// void * parm_;
|
||||
//};
|
||||
//
|
||||
//// ----------------------------------------------------------------------------
|
||||
//
|
||||
//class ThreadPool
|
||||
//{
|
||||
//public:
|
||||
// ThreadPool( void ) : m_threads()
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void Create( size_t threadCount, Thread::CallFunction function )
|
||||
// {
|
||||
// for( size_t ii = 0; ii < threadCount; ii++ )
|
||||
// {
|
||||
// string buffer;
|
||||
// SPrintf( buffer, "Creating thread %d\n" )( ii );
|
||||
// cout << buffer;
|
||||
// Thread * thread = new Thread( function,
|
||||
// reinterpret_cast< void * >( ii ) );
|
||||
// m_threads.push_back( thread );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Start( void )
|
||||
// {
|
||||
// for ( size_t ii = 0; ii < m_threads.size(); ii++ )
|
||||
// {
|
||||
// m_threads.at( ii )->Start();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// void Join( void ) const
|
||||
// {
|
||||
// for ( size_t ii = 0; ii < m_threads.size(); ii++ )
|
||||
// m_threads.at( ii )->WaitForThread();
|
||||
// }
|
||||
//
|
||||
// ~ThreadPool( void )
|
||||
// {
|
||||
// for ( size_t ii = 0; ii < m_threads.size(); ii++ )
|
||||
// {
|
||||
// delete m_threads.at(ii);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//private:
|
||||
// typedef std::vector< Thread * > Threads;
|
||||
//
|
||||
// Threads m_threads;
|
||||
//};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void * PrintSafeThread( void * p )
|
||||
{
|
||||
unsigned int value = reinterpret_cast< unsigned int >( p );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue