Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

iconoverlay: wrap _get_state() with a semaphore (issue#1)

This fixes the "blinking" icons in Vista, prevents overlay threads
from stomping each other. Also seems to stop endless refresh of the
repository root. It stops refreshing after one pass.

Changeset d70671084c48

Parent 3f29cde12204

by Steve Borho

Changes to one file · Browse files at d70671084c48 Showing diff from parent 3f29cde12204 Diff from another changeset...

 
10
11
12
 
13
14
15
 
38
39
40
 
 
41
42
43
 
198
199
200
 
201
 
202
203
204
205
206
 
207
208
209
 
10
11
12
13
14
15
16
 
39
40
41
42
43
44
45
46
 
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
@@ -10,6 +10,7 @@
 from mercurial import hg, cmdutil, util  import thgutil  import sys +import threading    try:   from mercurial.error import RepoError @@ -38,6 +39,8 @@
 cache_root = None  cache_pdir = None   +cache_lock = threading.Semaphore() +  # some misc constants  S_OK = 0  S_FALSE = 1 @@ -198,12 +201,15 @@
  return status     def IsMemberOf(self, path, attrib): + global cache_lock   try: + cache_lock.acquire()   tc = win32api.GetTickCount()   if self._get_state(path) == self.state:   return S_OK   return S_FALSE   finally: + cache_lock.release()   print "IsMemberOf(%s): _get_state() took %d ticks" % \   (self.state, win32api.GetTickCount() - tc)