diff options
author | Michal Minar <miminar@redhat.com> | 2013-02-13 19:48:45 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2013-02-13 20:02:50 +0100 |
commit | 73125fe7a43b560ec230004199ecd60690f9d063 (patch) | |
tree | 875070cc48d4ce7cbbb2bbf6e6242d17882d3611 /src/software/openlmi/software/yumdb/__init__.py | |
parent | 6af9610a5ac5f2d6b2473ae40a5029a72652f92d (diff) | |
download | openlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.tar.gz openlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.tar.xz openlmi-providers-73125fe7a43b560ec230004199ecd60690f9d063.zip |
fixed wrong thread synchronization
job could not be finished on rare occasions
Diffstat (limited to 'src/software/openlmi/software/yumdb/__init__.py')
-rw-r--r-- | src/software/openlmi/software/yumdb/__init__.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py index dc77689..2f41783 100644 --- a/src/software/openlmi/software/yumdb/__init__.py +++ b/src/software/openlmi/software/yumdb/__init__.py @@ -132,12 +132,13 @@ class YumDB(singletonmixin.Singleton): @return result of job """ with self._reply_lock: - # until our job is not at the head of self._expected.append(job.jobid) - while job.jobid != self._expected[0]: + while True: if job.jobid in self._replies: self._expected.remove(job.jobid) return self._replies.pop(job.jobid) + elif job.jobid == self._expected[0]: + break else: cmpi_logging.logger.debug( "[jobid=%d] another %s threads expecting reply," @@ -201,9 +202,11 @@ class YumDB(singletonmixin.Singleton): uplink = JoinableQueue() downlink = Queue() self._process = YumWorker(uplink, downlink, - yum_args=self._yum_args[0], yum_kwargs=self._yum_args[1]) - #logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG) + yum_args=self._yum_args[0], yum_kwargs=self._yum_args[1], + logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG) self._process.start() + cmpi_logging.logger.trace_info( + "YumDB: YumWorker started with pid=%s", self._process.pid) return self._process # ************************************************************************* |