PaCO++  0.05
paco_thread.cc
Go to the documentation of this file.
1 #if 0
2 #include "paco_thread.h"
3 
6 // Implementation of paco_mutex
7 
9 
10 
13 // Implementation of paco_condition
14 
16 
19 // Implementation of paco_fabrique_thread
20 
21 paco_fabrique_thread::paco_fabrique_thread() {}
23 
24 void paco_fabrique_thread::paco_register(const string& lib_thread, paco_individual_fabrique_thread * pift) {
25 
26  thread_map_t::iterator it = _thread_map.find(lib_thread);
27 
28  if (it == _thread_map.end() ) {
29  _thread_map[lib_thread] = pift;
30  } else {
31  cerr << "Ignoring: already register thread lib " << lib_thread << endl;
32  }
33 
34 }
35 
36 paco_mutex*
37 paco_fabrique_thread::paco_create_mutex(const string& lib_thread)
38 {
39  thread_map_t::iterator it = _thread_map.find(lib_thread);
40 
41  if (it == _thread_map.end() ) {
42  cerr << "Not found thread lib " << lib_thread << endl;
43  return NULL;
44  } else {
45  // cout << "Going to call paco_create_mutex of @ " << it->second << endl;
46  return it->second->paco_create_mutex();
47  }
48 }
49 
51 paco_fabrique_thread::paco_create_condition(const string& lib_thread, paco_mutex * mutex)
52 {
53  thread_map_t::iterator it = _thread_map.find(lib_thread);
54 
55  if (it == _thread_map.end() ) {
56  cerr << "Not found thread lib " << lib_thread << endl;
57  return NULL;
58  } else {
59  // cout << "Going to call paco_create_condition of @ " << it->second << endl;
60  return it->second->paco_create_condition((paco_mutex*) mutex);
61  }
62 }
64 paco_fabrique_thread::paco_create_thread(const string& lib_thread, void* (*fn)(void*), void* arg)
65  {
66  thread_map_t::iterator it = _thread_map.find(lib_thread);
67 
68  if (it == _thread_map.end() )
69  {
70  cerr << "Not found thread lib " << lib_thread << endl;
71  return NULL;
72  }
73  else
74  {
75  return it->second->paco_create_thread(fn, arg);
76  }
77  }
79 paco_fabrique_thread::paco_create_thread(const string& lib_thread, void (*fn)(void*), void* arg)
80  {
81  thread_map_t::iterator it = _thread_map.find(lib_thread);
82 
83  if (it == _thread_map.end() )
84  {
85  cerr << "Not found thread lib " << lib_thread << endl;
86  return NULL;
87  }
88  else
89  {
90  return it->second->paco_create_thread(fn, arg);
91  }
92  }
93 #endif
virtual paco_thread * paco_create_thread(void *(*fn)(void *), void *arg=NULL)=0
virtual ~paco_condition()
Definition: paco_thread.h:27
virtual paco_mutex * paco_create_mutex()=0
virtual paco_condition * paco_create_condition(paco_mutex *mutex)=0
virtual ~paco_fabrique_thread()
Definition: paco_thread.h:51
virtual ~paco_mutex()
Definition: paco_thread.h:16