Your concerns are correct, before the file lock is acquired do something simple like:

with self.cache.cacheLock:
      if not self.cache.readonly and self.cache.flushNodeQue is None:
           initialize

Norm

On 21/03/14 12:58 PM, Edward Chapin wrote:
> In vos/CadcCache.py:
>
> > +            with self.writerLock(shared=False):
> > +                # If flushing is not already in progress, submit to the thread
> > +                # queue.
> > +                if (self.flushThread is None and self.refCount == 1 and
> > +                        self.fileModified and not self.obsolete):
> > +
> > +                    self.refCount += 1
> > +
> > +                    # Old code: Launch a new short-lived thread
> > +                    #vos.logger.debug("Start flush thread")
> > +                    #self.flushThread = threading.Thread(target=self.flushNode,
> > +                    #        args=[])
> > +                    #self.flushThread.start()
> > +
> > +                    # New code: Use a thread queue
> > +                    with self.cache.cacheLock:
>
> One thing I just realized: where cacheLock is defined, there is a comment "When
> cache locks and file locks need to be held at the same time, always acquire the
> cache lock first.", so my guess is that this initialization should probably be
> moved before the "with self.fileCondition" earlier in this function...
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/ijiraq/cadcVOFS/pull/24/files#r10852017>.
>


-- 
signature

Norman R. Hill |Norman.Hill@nrc-cnrc.gc.ca
Tel/Tél (250) 363-0069 | Fax/Télécopieur (250) 363-0045
5071 West Saanich Road, Victoria BC V9E 2E7
5071, chemin West Saanich, Victoria (C.-B.) V9E 2E7
Herzberg Institute of Astrophysics | Institut Herzberg d'astrophysique
National Research Council Canada | Conseil national de recherches Canada
Government of Canada | Gouvernement du Canada