version 1.4, 2007/06/05 11:14:41
|
version 1.5, 2007/06/06 19:51:53
|
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
static int _executorSock = -1; | static int _executorSock = -1; |
static ExecutorImpl* _executorImpl = 0; |
static AutoPtr<ExecutorImpl> _executorImpl; |
static Mutex _executorMutex; | static Mutex _executorMutex; |
| |
static ExecutorImpl* _getImpl() | static ExecutorImpl* _getImpl() |
|
|
// Use the double-checked locking technique to avoid the overhead of a lock | // Use the double-checked locking technique to avoid the overhead of a lock |
// on every call. | // on every call. |
| |
if (_executorImpl == 0) |
if (_executorImpl.get() == 0) |
{ | { |
AutoMutex autoMutex(_executorMutex); | AutoMutex autoMutex(_executorMutex); |
| |
if (_executorImpl == 0) |
if (_executorImpl.get() == 0) |
{ | { |
#if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) | #if defined(PEGASUS_ENABLE_PRIVILEGE_SEPARATION) |
if (_executorSock == -1) | if (_executorSock == -1) |
_executorImpl = new ExecutorLoopbackImpl(); |
_executorImpl.reset(new ExecutorLoopbackImpl()); |
else | else |
_executorImpl = new ExecutorSocketImpl(_executorSock); |
_executorImpl.reset(new ExecutorSocketImpl(_executorSock)); |
#else | #else |
_executorImpl = new ExecutorLoopbackImpl(); |
_executorImpl.reset(new ExecutorLoopbackImpl()); |
#endif | #endif |
} | } |
} | } |
| |
return _executorImpl; |
return _executorImpl.get(); |
} | } |
| |
void Executor::setSock(int sock) | void Executor::setSock(int sock) |