Revision 1238 branches/threaded2merge/src/linad99/adthread.h

adthread.h (revision 1238)
8 8
#include <stdlib.h>     /* General Utilities */
9 9
#include <pthread.h>    /* POSIX Threads */
10 10
#include <string.h>     /* String handling */
11
#include <string>     /* String handling */
11 12

  
12 13
typedef ofstream * pofstream;
13 14
typedef void* (*pthreadfun)(void*);
......
25 26
public:
26 27
  int thread_no;
27 28
};
29
/**
30
Make a member of manager class.
31
 */
28 32
class adthread_buffer
29 33
{
30 34
public:
......
38 42

  
39 43
  bool islocked() const { return locked; }
40 44

  
45
  void push(const int value);
46
  void pop(int& value);
47
  void push(const size_t value);
48
  void pop(size_t& value);
49
  void push(const double value);
50
  void pop(double& value);
51
  void push(const char* value);
52
  void pop(char* value);
53

  
41 54
private:
42 55
  bool locked;
43 56
  pthread_mutex_t mutex;
44 57
  pthread_cond_t condition;
58
  std::string buffer;
45 59
};
60
class adthread
61
{
62
public:
63
  adthread();
64
  adthread(const adthread& other);
65
  virtual ~adthread();
66

  
67
public:
68
  void create();
69

  
70
private:
71
  void routine();
72

  
73
private:
74
  adthread_buffer buffer;
75
};
46 76
class adpthread_manager
47 77
{
48 78
private:

Also available in: Unified diff