-
Notifications
You must be signed in to change notification settings - Fork 0
/
Process.cpp
54 lines (38 loc) · 1.16 KB
/
Process.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <iostream>
#include "Process.hpp"
//Calls to fork and exec for the constructor
//Call to wait for deconstructor
//The extra bool argument can be used to enable verbose messages
Process::Process(const std::vector<char*>&, bool verbose)
{
m_pid = fork();
m_pid = fork();
//int n_pid = fork();
// std::cout<<"This is the constructor with extra bool" << std::endl;
std::cout <<"The process being forked = " << m_pid << std::endl;
// std::cout <<"The n_pid = " << n_pid << std::endl;
}
Process::Process(const std::vector<char*>&)
{
m_pid = fork();
std::cout<<"This is the constructor with no bool" << std::endl;
}
// prevent copying and assignment
Process::Process(const Process &p)
{
m_pid = fork();
std::cout << "This is the constructor to prevent copying and assignment" << std::endl;
}
//Implement a move constructor
Process::Process(Process& other)
{
std::cout << "This is the constructor that moves, but I have implemented nothing here yet" << std::endl;
}
Process::~Process(){
//m_pid =
m_pid = wait(&m_status);
exit(m_status);
}