public
Description: Phusion Passenger (mod_rails)
Homepage: http://www.modrails.com/
Clone URL: git://github.com/FooBarWidget/passenger.git
Search Repo:
Click here to lend your support to: passenger and make a donation at www.pledgie.com !
- Document thread-safetiness of MessageChannel.
- Correctly use errno in SpawnManager.
FooBarWidget (author)
Fri Feb 01 13:09:31 -0800 2008
commit  aadf427bf3d5d7b0a1a164d50b35a1d71febefc3
tree    fb80451455fce166379cace0ddfd6f0b440357f3
parent  a92649cae9d3a26508f13b8f2cb73694216335ac
...
48
49
50
 
51
52
53
...
48
49
50
51
52
53
54
0
@@ -48,6 +48,7 @@
0
  * If the other side of the communication channel first tries to
0
  * receive a file descriptor, and then tries to receive a message,
0
  * then bad things will happen.
0
+ * @note MessageChannel is thread-safe.
0
  */
0
 class MessageChannel {
0
 private:
...
118
119
120
121
 
 
122
123
 
124
125
126
127
128
129
130
 
131
132
133
...
224
225
226
 
 
227
228
229
...
118
119
120
 
121
122
123
124
125
126
127
128
129
130
131
 
132
133
134
135
...
226
227
228
229
230
231
232
233
0
@@ -118,16 +118,18 @@
0
       }
0
       
0
       execlp(rubyCommand.c_str(), rubyCommand.c_str(), spawnServerCommand.c_str(), NULL);
0
- fprintf(stderr, "Unable to run %s: %s\n", rubyCommand.c_str(), strerror(errno));
0
+ int e = errno;
0
+ fprintf(stderr, "Unable to run %s: %s\n", rubyCommand.c_str(), strerror(e));
0
       _exit(1);
0
     } else if (pid == -1) {
0
+ int e = errno;
0
       close(fds[0]);
0
       close(fds[1]);
0
       if (logFileHandle != NULL) {
0
         fclose(logFileHandle);
0
       }
0
       pid = 0;
0
- throw SystemException("Unable to fork a process", errno);
0
+ throw SystemException("Unable to fork a process", e);
0
     } else {
0
       close(fds[1]);
0
       if (!logFile.empty()) {
0
@@ -224,6 +226,8 @@
0
     mutex::scoped_lock l(lock);
0
     
0
     if (serverNeedsRestart) {
0
+ // TODO: This is not the best place to restart the server.
0
+ // Ideally a spawn() should fail as least as possible.
0
       try {
0
         P_TRACE("Restarting spawn server.");
0
         restartServer();

Comments

    No one has commented yet.