GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
commit  af29aeaa1d4bf975824b14fe7577168055045d01
tree    13c83296ba7c9cb58f58554897e84ab769f21703
parent  040201494bc0c798e543c0b2e1287ad15062ffa3
passenger / ext / apache2 / Application.h
100644 73 lines (57 sloc) 1.117 kb
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _PASSENGER_APPLICATION_H_
#define _PASSENGER_APPLICATION_H_
 
#include <sys/types.h>
#include <boost/shared_ptr.hpp>
#include <string>
 
namespace Passenger {
 
using namespace std;
using namespace boost;
 
// TODO: write better documentation
class Application {
private:
  string appRoot;
  pid_t pid;
  int reader, writer;
public:
  Application(const string &theAppRoot, pid_t pid, int reader, int writer) {
    appRoot = theAppRoot;
    this->pid = pid;
    this->reader = reader;
    this->writer = writer;
  }
  
  ~Application() {
    closeReader();
    closeWriter();
  }
  
  void detachCommunicationChannels() {
    reader = -1;
    writer = -1;
  }
  
  string getAppRoot() const {
    return appRoot;
  }
  
  pid_t getPid() const {
    return pid;
  }
  
  int getReader() const {
    return reader;
  }
  
  int getWriter() const {
    return writer;
  }
  
  void closeReader() {
    if (reader != -1) {
      close(reader);
      reader = -1;
    }
  }
  
  void closeWriter() {
    if (writer != -1) {
      close(writer);
      writer = -1;
    }
  }
};
 
typedef shared_ptr<Application> ApplicationPtr;
 
} // namespace Passenger
 
#endif /* _PASSENGER_APPLICATION_H_ */