PaCO++  0.05
paco_thread.cc
Go to the documentation of this file.
00001 #if 0
00002 #include "paco_thread.h"
00003 
00006 // Implementation of paco_mutex
00007 
00008 paco_mutex::~paco_mutex() {}
00009 
00010 
00013 // Implementation of paco_condition
00014 
00015 paco_condition::~paco_condition() {}
00016 
00019 // Implementation of paco_fabrique_thread
00020 
00021 paco_fabrique_thread::paco_fabrique_thread() {}
00022 paco_fabrique_thread::~paco_fabrique_thread() {}
00023 
00024 void paco_fabrique_thread::paco_register(const string& lib_thread, paco_individual_fabrique_thread * pift) {
00025 
00026   thread_map_t::iterator it = _thread_map.find(lib_thread);
00027 
00028   if (it == _thread_map.end() ) {
00029     _thread_map[lib_thread] = pift;
00030   } else {
00031     cerr << "Ignoring: already register thread lib " << lib_thread << endl;
00032   }
00033 
00034 }
00035   
00036 paco_mutex* 
00037 paco_fabrique_thread::paco_create_mutex(const string& lib_thread)
00038 {
00039   thread_map_t::iterator it = _thread_map.find(lib_thread);
00040 
00041   if (it == _thread_map.end() ) {
00042     cerr << "Not found thread lib " << lib_thread << endl;
00043     return NULL;
00044   } else {
00045     //    cout << "Going to call paco_create_mutex of @ " << it->second << endl;
00046     return it->second->paco_create_mutex();
00047   }
00048 }
00049 
00050 paco_condition* 
00051 paco_fabrique_thread::paco_create_condition(const string& lib_thread, paco_mutex * mutex)
00052 {
00053   thread_map_t::iterator it = _thread_map.find(lib_thread);
00054 
00055   if (it == _thread_map.end() ) {
00056     cerr << "Not found thread lib " << lib_thread << endl;
00057     return NULL;
00058   } else {
00059     //    cout << "Going to call paco_create_condition of @ " << it->second << endl;
00060     return it->second->paco_create_condition((paco_mutex*) mutex);
00061   }
00062 }
00063 paco_thread *
00064 paco_fabrique_thread::paco_create_thread(const string& lib_thread, void* (*fn)(void*), void* arg)
00065   {
00066     thread_map_t::iterator it = _thread_map.find(lib_thread);
00067 
00068     if (it == _thread_map.end() ) 
00069       {
00070    cerr << "Not found thread lib " << lib_thread << endl;
00071    return NULL;
00072       } 
00073     else 
00074       {
00075    return it->second->paco_create_thread(fn, arg);
00076       }
00077   }
00078 paco_thread *
00079 paco_fabrique_thread::paco_create_thread(const string& lib_thread, void (*fn)(void*), void* arg)
00080   {
00081     thread_map_t::iterator it = _thread_map.find(lib_thread);
00082 
00083     if (it == _thread_map.end() ) 
00084       {
00085    cerr << "Not found thread lib " << lib_thread << endl;
00086    return NULL;
00087       } 
00088     else 
00089       {
00090    return it->second->paco_create_thread(fn, arg);
00091       }
00092   }
00093 #endif