Protium
Math and Design Features
 All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Pages
Thread.h
Go to the documentation of this file.
1 #ifndef Protium_Thread_h_
2 #define Protium_Thread_h_
3 
4 
5 namespace Protium{
6 
7  namespace Threads{
8 
9  //Use this to call up the thread, the owning object will then
11  thread->start();
12  }
13 
21  pthread_t thread;
22  //Add this to
23 
24  void Create(){
25  pthread_create (thread,attr,threadingFunction,this);
26  }
27  void Exit(){
28  pthread_exit (status);
29  }
30  void Cancel(){
31  pthread_cancel (thread);
32  }
33  void Init(){
34  pthread_attr_init (attr);
35  }
36  void Kill(){
37  pthread_attr_destroy(attr);
38  }
39 
40  //Override this for a threading routine
41  void start() =0;
42  //TODO: Add in joining
43  void join(){
44  pthread_join(thread[t], &status);
45  }
46 
47  pid_t thisThread(){
48  return pthread_self();
49  }
50 
51  bool equal(pid_t& other){
52  return (this->pid, other);
53  }
54 
55 
56 pthread_attr_getstacksize (attr, stacksize)
57 
58 pthread_attr_setstacksize (attr, stacksize)
59 
60 pthread_attr_getstackaddr (attr, stackaddr)
61 
62 pthread_attr_setstackaddr (attr, stackaddr)
63  void setstacksize(){
64  pthread_attr_setstacksize(/*It's over NINE THOUSAND!!!*/);
65  }
66  };
67 
68  //TODO: Add in the parent singleton which will be used to spawn the threads from the parent thread.
69  //TODO; THe Parent singleton needs to finish last with pthread_exit(null); as an one of it's parameters.
70  }
71 }
72 
73 
74 
75 #endif //File Guardian
76 
void threadingFunction(AbstractThread *thread)
Definition: Thread.h:10
stacksize stackaddr void setstacksize()
Definition: Thread.h:63
bool equal(pid_t &other)
Definition: Thread.h:51
stacksize pthread_attr_getstackaddr(attr, stackaddr) pthread_attr_setstackaddr(attr
pthread_attr_getstacksize(attr, stacksize) pthread_attr_setstacksize(attr