Index: ext/apache2/ApplicationPoolServerExecutable.cpp
===================================================================
--- ext/apache2/ApplicationPoolServerExecutable.cpp.orig	1970-01-01 01:00:00.000000000 +0100
+++ ext/apache2/ApplicationPoolServerExecutable.cpp	2008-12-17 16:51:53.045024542 +0100
@@ -245,7 +245,7 @@ private:
 					toString(lastSessionID - 1).c_str(), NULL);
 				channel.writeFileDescriptor(session->getStream());
 				session->closeStream();
-			} catch (const exception &) {
+			} catch (const std::exception &) {
 				P_TRACE(3, "Client " << this << ": something went wrong "
 					"while sending 'ok' back to the client.");
 				sessions.erase(lastSessionID - 1);
@@ -350,7 +350,7 @@ private:
 			}
 		} catch (const boost::thread_interrupted &) {
 			P_TRACE(2, "Client thread " << this << " interrupted.");
-		} catch (const exception &e) {
+		} catch (const std::exception &e) {
 			P_TRACE(2, "Uncaught exception in ApplicationPoolServer client thread:\n"
 				<< "   message: " << toString(args) << "\n"
 				<< "   exception: " << e.what());
@@ -480,7 +480,7 @@ main(int argc, char *argv[]) {
 		Server server(SERVER_SOCKET_FD, atoi(argv[1]),
 			argv[2], argv[3], argv[4], argv[5], argv[6]);
 		return server.start();
-	} catch (const exception &e) {
+	} catch (const std::exception &e) {
 		P_ERROR(e.what());
 		return 1;
 	}
Index: ext/apache2/Exceptions.h
===================================================================
--- ext/apache2/Exceptions.h.orig	1970-01-01 01:00:00.000000000 +0100
+++ ext/apache2/Exceptions.h	2008-12-17 16:51:53.069025286 +0100
@@ -41,7 +41,7 @@ using namespace std;
  *
  * @ingroup Exceptions
  */
-class SystemException: public exception {
+class SystemException: public std::exception {
 private:
 	string briefMessage;
 	string systemMessage;
@@ -132,7 +132,7 @@ public:
  *
  * @ingroup Exceptions
  */
-class IOException: public exception {
+class IOException: public std::exception {
 private:
 	string msg;
 public:
@@ -153,7 +153,7 @@ public:
 /**
  * Thrown when an invalid configuration is given.
  */
-class ConfigurationException: public exception {
+class ConfigurationException: public std::exception {
 private:
 	string msg;
 public:
@@ -167,7 +167,7 @@ public:
  * instance. The exception may contain an error page, which is a user-friendly
  * HTML page with details about the error.
  */
-class SpawnException: public exception {
+class SpawnException: public std::exception {
 private:
 	string msg;
 	bool m_hasErrorPage;
@@ -208,7 +208,7 @@ public:
  *
  * @ingroup Exceptions
  */
-class BusyException: public exception {
+class BusyException: public std::exception {
 private:
 	string msg;
 public:
Index: ext/apache2/Hooks.cpp
===================================================================
--- ext/apache2/Hooks.cpp.orig	1970-01-01 01:00:00.000000000 +0100
+++ ext/apache2/Hooks.cpp	2008-12-17 16:51:53.089421952 +0100
@@ -286,7 +286,7 @@ private:
 				P_TRACE(3, "A system call was interrupted during closing "
 					"of a session. Apache is probably restarting or "
 					"shutting down.");
-			} catch (const exception &e) {
+			} catch (const std::exception &e) {
 				P_TRACE(3, "Exception during closing of a session: " <<
 					e.what());
 			}
@@ -743,7 +743,7 @@ public:
 			P_TRACE(3, "A system call was interrupted during an HTTP request. Apache "
 				"is probably restarting or shutting down.");
 			return HTTP_INTERNAL_SERVER_ERROR;
-		} catch (const exception &e) {
+		} catch (const std::exception &e) {
 			ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "*** Unexpected error in Passenger: %s", e.what());
 			return HTTP_INTERNAL_SERVER_ERROR;
 		}
@@ -862,7 +862,7 @@ destroy_hooks(void *arg) {
 	} catch (const thread_interrupted &) {
 		// Ignore interruptions, we're shutting down anyway.
 		P_TRACE(3, "A system call was interrupted during shutdown of mod_passenger.");
-	} catch (const exception &e) {
+	} catch (const std::exception &e) {
 		// Ignore other exceptions, we're shutting down anyway.
 		P_TRACE(3, "Exception during shutdown of mod_passenger: " << e.what());
 	}
@@ -942,7 +942,7 @@ init_module(apr_pool_t *pconf, apr_pool_
 		
 		return DECLINED;
 		
-	} catch (const exception &e) {
+	} catch (const std::exception &e) {
 		ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
 			"*** Passenger could not be initialized because of this error: %s",
 			e.what());
Index: ext/apache2/StandardApplicationPool.h
===================================================================
--- ext/apache2/StandardApplicationPool.h.orig	1970-01-01 01:00:00.000000000 +0100
+++ ext/apache2/StandardApplicationPool.h	2008-12-17 16:51:53.105433203 +0100
@@ -26,6 +26,7 @@
 #include <boost/bind.hpp>
 #include <boost/date_time/microsec_time_clock.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/thread/condition.hpp>
 
 #include <string>
 #include <sstream>
@@ -344,7 +345,7 @@ private:
 					}
 				}
 			}
-		} catch (const exception &e) {
+		} catch (const std::exception &e) {
 			P_ERROR("Uncaught exception: " << e.what());
 		}
 	}
@@ -501,7 +502,7 @@ private:
 			} else {
 				throw SpawnException(message);
 			}
-		} catch (const exception &e) {
+		} catch (const std::exception &e) {
 			string message("Cannot spawn application '");
 			message.append(appRoot);
 			message.append("': ");
@@ -611,7 +612,7 @@ public:
 				"State is valid:\n" << toString(false));
 			try {
 				return container->app->connect(SessionCloseCallback(data, container));
-			} catch (const exception &e) {
+			} catch (const std::exception &e) {
 				container->sessions--;
 				if (attempt == MAX_GET_ATTEMPTS) {
 					string message("Cannot connect to an existing "
