KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
l_mt_pt_attr.h
Go to the documentation of this file.
1 
6 /*
7  * $Id: l_mt_pt_attr.h 17433 2014-09-02 02:52:04Z predoehl $
8  */
9 
10 #ifndef PT_ATTR_H_INCLUDED_IVILAB
11 #define PT_ATTR_H_INCLUDED_IVILAB
12 
13 #include <l_mt/l_mt_pthread.h>
14 #include <l_cpp/l_exception.h>
15 
16 namespace kjb
17 {
18 
56 {
57  // private attribute object
58  kjb_c::kjb_pthread_attr_t m_attr;
59 
60  Pthread_attr(const Pthread_attr&); // teaser: do not copy
61  Pthread_attr& operator=(const Pthread_attr&); // teaser: do not assign
62 
63 public:
66  {
67  ETX(kjb_c::kjb_pthread_attr_init(&m_attr));
68  }
69 
72  {
73  kjb_c::kjb_pthread_attr_destroy(&m_attr);
74  }
75 
83  int setdetachstate(int state)
84  {
85  return kjb_c::kjb_pthread_attr_setdetachstate(&m_attr, state);
86  }
87 
90  {
91  return setdetachstate(KJB_PTHREAD_CREATE_DETACHED);
92  }
93 
101  int getdetachstate(int* state)
102  {
103  return kjb_c::kjb_pthread_attr_getdetachstate(&m_attr, state);
104  }
105 
107  operator const kjb_c::kjb_pthread_attr_t*()
108  {
109  return &m_attr;
110  }
111 };
112 
114 
115 } // end ns kjb
116 
117 #endif /* PT_ATTR_H_INCLUDED_IVILAB */
int setdetachstate(int state)
set the detach flag.
Definition: l_mt_pt_attr.h:83
#define ETX(a)
Definition: l_exception.h:67
int set_detached()
convenience synonym setdetachstate(KJB_PTHREAD_CREATE_DETACHED)
Definition: l_mt_pt_attr.h:89
RAII class to manage an object of type kjb_pthread_attr_t.
Definition: l_mt_pt_attr.h:55
int getdetachstate(int *state)
obtain the detach setting of this object.
Definition: l_mt_pt_attr.h:101
~Pthread_attr()
destroy an attribute object.
Definition: l_mt_pt_attr.h:71
Pthread_attr()
initialize a generic attribute object.
Definition: l_mt_pt_attr.h:65
Support for error handling exception classes in libKJB.