Skip to content

Commit

Permalink
Use a named constant for the sqlite thread safety mode.
Browse files Browse the repository at this point in the history
Co-authored-by: Padraic Shafer <[email protected]>
  • Loading branch information
canismarko and padraic-shafer authored Feb 21, 2024
1 parent 0a25957 commit b3fe529
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tiled/client/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ def write_safe(self):
lock (``@with_thread_lock``) to prevent parallel writes.
"""
SERIALIZED = 3 # Could be defined in an enum elsewhere
is_main_thread = threading.current_thread().ident == self._owner_thread
sqlite_is_safe = sqlite3.threadsafety > 2
sqlite_is_safe = sqlite3.threadsafety == SERIALIZED
return is_main_thread or sqlite_is_safe

def __getstate__(self):
Expand Down

0 comments on commit b3fe529

Please sign in to comment.