Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nrami006 threads #9

Merged
merged 9 commits into from
Nov 25, 2014
Merged

Nrami006 threads #9

merged 9 commits into from
Nov 25, 2014

Conversation

iagui005
Copy link
Owner

No description provided.

Moved threadGraveyard declaration/definition and condition::wait() definition up a bit so that thread_cancel() could be called where pthread_exit() used to be called.
Implemented pseudoProcess class that derives from Thread. 
Constructor takes in the name, priority, and vector of strings. 
Action creates an argv from the vector of strings and then forks and execs argv (the fork is so that the main thread does not die).

This seems to be working so far. Just need to implement it with the shell code now.  Maybe move pseudoProcess into the thread.h file. 

Note: If you want them to be able to call join(), you need to derive publically from Thread. 
i.e: class pseudoProcess : public Thread {
...
};
Moved implementation of pseudoProcess into the shell team's code and defined its action() to be their 'thread_run()' function. 
I also replaced their calls to std::thread(...) with pseudoProcess(...).
It works with shellThread.h file which is just a modified workingThread.h (I just moved the pseudoProcess out of there and into the shellMain.cc file). 

Notes:
If the shell code is going to be a .h file, maybe we could move pseudoProcess back into our thread.h file by including the shell.h file into our thread.h file. That way we could have access to their functions without having to copy it into our file.
Moved pseudoProcess into shellMain.cc.
Added parent Thread* and a threaD_id member variable that stores the threads own id.
Commented out debugging classes and comments and asserts
Cleaned up. 
took out debugging classes/ comments/ asserts. 
Tested with shell team code and it should work.
Modified shell team code to include a shellThread class as well as use it. should work with threads.h
iagui005 added a commit that referenced this pull request Nov 25, 2014
@iagui005 iagui005 merged commit 305aba7 into master Nov 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants