diff options
| author | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-29 00:58:33 +0100 |
|---|---|---|
| committer | Ewan Mellor <ewan.mellor@citrix.com> | 2010-07-29 00:58:33 +0100 |
| commit | 04a6a0267e7dc0f4e587e43f23b4acf0dcef52fc (patch) | |
| tree | 6bcdfafed1cb2332ebd8b7c0d03b4fed4a82520e /nova/process.py | |
| parent | 9f4996e8738991a95a23cba2caa660f7002f94cd (diff) | |
| download | nova-04a6a0267e7dc0f4e587e43f23b4acf0dcef52fc.tar.gz nova-04a6a0267e7dc0f4e587e43f23b4acf0dcef52fc.tar.xz nova-04a6a0267e7dc0f4e587e43f23b4acf0dcef52fc.zip | |
More merges from trunk. Not everything came over the first time.
Diffstat (limited to 'nova/process.py')
| -rw-r--r-- | nova/process.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/nova/process.py b/nova/process.py index 8ecef1584..d3558ed2e 100644 --- a/nova/process.py +++ b/nova/process.py @@ -205,12 +205,13 @@ class ProcessPool(object): self._pool.release() return rv -_instance = None -def SharedPool(): - global _instance - if _instance is None: - _instance = ProcessPool() - return _instance +class SharedPool(ProcessPool): + _instance = None + def __new__(cls, *args, **kwargs): + if not cls._instance: + cls._instance = super(SharedPool, cls).__new__( + cls, *args, **kwargs) + return cls._instance def simple_execute(cmd, **kwargs): return SharedPool().simple_execute(cmd, **kwargs) |
