tac0S
Template Affectional Command Operating System
userthread.h
Go to the documentation of this file.
1 
7 #ifndef USERTHREAD_H
8 #define USERTHREAD_H
9 
10 #include "copyright.h"
11 #include "thread.h"
12 #include "utility.h"
13 #include "synchlist.h"
14 #include "ManagerUserThreadID.h"
15 #include "UserThreadMetadata.h"
16 
17 #include "openfile.h"
18 
19 
20 extern void StartUserThread(int data);
21 
22 
23 typedef struct
24 {
25  void * f;
26  void * arg;
27  int exit;
28 } thread_init;
29 
30 
31 class UserThread {
32 public:
33 
34  UserThread(void * ,void * arg, unsigned int tid, int exitPC);
35  ~UserThread();
36  void Run();
37  unsigned int getId();
38  void exit(void * returnAdress);
39  void * WaitForChildExited(int CID);
40  // EXPERT MODE
41 
42  void WaitForAllChildExited();
43  int StopChild(unsigned int CID);
44  int WakeUpChild(unsigned int CID);
45  int makeChildSurvive(unsigned int CID);
46  void makeAllChildSurvive();
47  List * getChildList();
48  void DoneWithTheChildList();
49  Thread * getThread();
50  bool removeChild(void * childToRemove);
51  void addChildren(UserThread * UTC);
52  void setParrent(UserThread * UTP);
54  void * getUserThreadDataChild(unsigned int CID);
55  void * getMeta();
56  void setMeta(void *);
57  bool isSurvivor();
58  void setSurvivor(bool boolean);
59  int* getTableOfOpenfile();
60 
61  private:
62  void * returnObject;
63  bool WaitingForChild = false;
64  Thread * thread;
65  unsigned int ID;
66  UserThread * parent;
67  SynchList * child;
68  thread_init dataFork;
69  void * metaData;
70  bool survivor;
71  int* TableOfOpenfile;
72 
73 };
74 
75 #endif // USERTHREAD_H
void addChildren(UserThread *UTC)
UserThread::addChildren Add a thread to the child list.
Definition: userthread.cc:205
void DoneWithTheChildList()
UserThread::DoneWithTheChildList trash the lock Locked from getChildList.
Definition: userthread.cc:67
~UserThread()
UserThread::~UserThread Delete the UserThread class.
Definition: userthread.cc:41
void * getUserThreadDataChild(unsigned int CID)
UserThread::getUserThreadDataChild Get the Meta Data structure of the child with TID CID...
Definition: userthread.cc:224
void setSurvivor(bool boolean)
UserThread::setSurvivor Enable or disable the survivor mode.
Definition: userthread.cc:260
void StartUserThread(int data)
StartUserThread Init the NachOS thread.
Definition: exception.cc:286
void exit(void *returnAdress)
UserThread::exit Finis the thread. Put information on the current UserThreadData if it had a parent...
Definition: userthread.cc:93
void Run()
UserThread::Run Do the fork and place the thread into the ready list.
Definition: userthread.cc:75
void WaitForAllChildExited()
UserThread::WaitForAllChildExited Wait for all the child exited.
Definition: userthread.cc:151
User thread implementation.
The following class defines a "thread control block" – which represents a single thread of execution...
Definition: thread.h:79
Data structures for opening, closing, reading and writing.
Data structures for managing threads.
Definition: userthread.h:31
bool isSurvivor()
UserThread::isSurvivor Test if the current thread is in mode survivor.
Definition: userthread.cc:252
UserThread * getParrent()
UserThread::getParrent Get the UserThread * parrent.
Definition: userthread.cc:267
int makeChildSurvive(unsigned int CID)
UserThread::makeChildSurvive Pass a child in suvivor mode.
Definition: userthread.cc:168
Definition: list.h:46
User thread implementation.
void * getMeta()
UserThread::getMeta return the adress of the metaStructure.
Definition: userthread.cc:239
void * WaitForChildExited(int CID)
UserThread::WaitForChildExited Current thraid will wait that his child end.
Definition: userthread.cc:128
bool removeChild(void *childToRemove)
UserThread::removeChild Remove the child of the current child list.
Definition: userthread.cc:194
Definition: userthread.h:23
void makeAllChildSurvive()
UserThread::makeAllChildSurvive Put all the child of the current thread in survivor mode...
Definition: userthread.cc:179
void setMeta(void *)
UserThread::setMeta Set a metaData for the current thread.
Definition: userthread.cc:245
Thread * getThread()
UserThread::getThread Get the Thread of the UserThread.
Definition: userthread.cc:52
Miscellaneous useful definitions, including debugging routines.
unsigned int getId()
UserThread::getId() get The Thread Id.
Definition: userthread.cc:85
Data structures for synchronized access to a list.
UserThread(void *, void *arg, unsigned int tid, int exitPC)
UserThread::UserThread.
Definition: userthread.cc:20
The following class defines a "synchronized list" – a list for which: these constraints hold: ...
Definition: synchlist.h:27
void setParrent(UserThread *UTP)
UserThread::setParrent Add a parrent to the current thread.
Definition: userthread.cc:215
Definition: out.c:36
List * getChildList()
UserThread::getChildList Get the child list and put a lock on it when done, don't forget to use DoneW...
Definition: userthread.cc:60