1
1
import collections
2
2
import inspect
3
3
import io
4
- import threading
5
4
import weakref
6
5
from typing import (
7
6
Any ,
17
16
18
17
from typing_extensions import Self
19
18
19
+ from robotcode .core .concurrent import RLock
20
20
from robotcode .core .event import event
21
21
from robotcode .core .lsp .types import DocumentUri , Position , Range
22
22
from robotcode .core .uri import Uri
@@ -85,7 +85,7 @@ class CacheEntry:
85
85
def __init__ (self ) -> None :
86
86
self .data : Any = None
87
87
self .has_data : bool = False
88
- self .lock = threading . RLock ()
88
+ self .lock = RLock (name = "Document.CacheEntry.lock" , default_timeout = 120 )
89
89
90
90
91
91
class TextDocument :
@@ -100,7 +100,7 @@ def __init__(
100
100
) -> None :
101
101
super ().__init__ ()
102
102
103
- self ._lock = threading . RLock ()
103
+ self ._lock = RLock (name = f"Document.lock ' { document_uri } '" , default_timeout = 120 )
104
104
self .document_uri = document_uri
105
105
self .uri = Uri (self .document_uri ).normalized ()
106
106
self .language_id = language_id
@@ -110,7 +110,7 @@ def __init__(
110
110
self ._orig_version = version
111
111
self ._lines : Optional [List [str ]] = None
112
112
self ._cache : Dict [weakref .ref [Any ], CacheEntry ] = collections .defaultdict (CacheEntry )
113
- self ._data_lock = threading . RLock ()
113
+ self ._data_lock = RLock (name = f"Document.data_lock ' { document_uri } '" , default_timeout = 120 )
114
114
self ._data : weakref .WeakKeyDictionary [Any , Any ] = weakref .WeakKeyDictionary ()
115
115
self .opened_in_editor = False
116
116
0 commit comments