aboutsummaryrefslogtreecommitdiff
path: root/odb/details/posix/thread.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/details/posix/thread.ixx')
-rw-r--r--odb/details/posix/thread.ixx34
1 files changed, 34 insertions, 0 deletions
diff --git a/odb/details/posix/thread.ixx b/odb/details/posix/thread.ixx
new file mode 100644
index 0000000..389cc2e
--- /dev/null
+++ b/odb/details/posix/thread.ixx
@@ -0,0 +1,34 @@
+// file : odb/details/posix/thread.ixx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
+// license : GNU GPL v2; see accompanying LICENSE file
+
+#include <odb/details/posix/exceptions.hxx>
+
+namespace odb
+{
+ namespace details
+ {
+ inline thread::
+ ~thread ()
+ {
+ if (!detached_)
+ {
+ if (int e = pthread_detach (id_))
+ throw posix_exception (e);
+ }
+ }
+
+ inline void* thread::
+ join ()
+ {
+ void* r;
+
+ if (int e = pthread_join (id_, &r))
+ throw posix_exception (e);
+
+ detached_ = true;
+ return r;
+ }
+ }
+}