forked from dravanet/truenas-middleware
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(py-libzfs): drop lock from context manager
- Loading branch information
1 parent
127202d
commit ef7a331
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
nas_ports/devel/py-libzfs/files/patch-simple-context-manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git libzfs.pyx libzfs.pyx | ||
index 6f9ac94..0b305df 100644 | ||
--- libzfs.pyx | ||
+++ libzfs.pyx | ||
@@ -21,7 +21,6 @@ from libc.stdlib cimport realloc | ||
import errno as py_errno | ||
import urllib.parse | ||
|
||
-GLOBAL_CONTEXT_LOCK = threading.Lock() | ||
logger = logging.getLogger(__name__) | ||
|
||
|
||
@@ -519,24 +518,14 @@ cdef class ZFS(object): | ||
self.proptypes[t] = proptypes | ||
|
||
def __enter__(self): | ||
- GLOBAL_CONTEXT_LOCK.acquire() | ||
return self | ||
|
||
def __exit__(self, exc_type, value, traceback): | ||
- self.__libzfs_fini() | ||
- GLOBAL_CONTEXT_LOCK.release() | ||
- if exc_type is not None: | ||
- raise | ||
- | ||
- def __libzfs_fini(self): | ||
- if self.handle: | ||
- with nogil: | ||
- libzfs.libzfs_fini(self.handle) | ||
- | ||
- self.handle = NULL | ||
+ pass | ||
|
||
def __dealloc__(self): | ||
- ZFS.__libzfs_fini(self) | ||
+ with nogil: | ||
+ libzfs.libzfs_fini(self.handle) | ||
|
||
def asdict(self): | ||
return [p.asdict() for p in self.pools] |