Yurttas/PL/OOL/Cplusplus/F/02/08/01/00/thread.cpp
Jump to navigation
Jump to search
1/*
2 Copyright(C) 2005
3 All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
4
5 Permission to use, copy, modify, and distribute this
6 software and its documentation for EDUCATIONAL purposes
7 and without fee is hereby granted provided that this
8 copyright notice appears in all copies.
9
10 date : September 1, 2005.
11 author : Austin W. Westfall, Salih Yurttas.
12
13 thread.cpp
14*/
15
16
17#include "thread.h"
18
19thread::
20~thread() {
21}
22
23void*
24thread::
25dispatch(void * p) {
26 static_cast<thread *> (p)->run();
27 pthread_exit(p);
28 return 0;
29}
30
31void
32thread::
33start() {
34 pthread_create(&pt,
35 0,
36 thread::dispatch,
37 this);
38}
39
40void
41thread::
42join() {
43 pthread_join(pt,
44 0);
45}