Skip to content

Commit

Permalink
store clib on module level - shared between all instances
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Jan 30, 2024
1 parent a34b2b4 commit 217b537
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 80 deletions.
3 changes: 2 additions & 1 deletion pygeodiff/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
:license: MIT, see LICENSE for more details.
"""

from .main import GeoDiff
from .main import GeoDiff, shutdown

from .geodifflib import (
GeoDiffLibError,
GeoDiffLibConflictError,
Expand Down
22 changes: 22 additions & 0 deletions pygeodiff/geodifflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,28 @@
import copy


clib_module = None


def clib():
global clib_module
return clib_module


def init_clib(libname):
global clib_module
if clib_module is None:
clib_module = GeoDiffLib(libname)
return clib_module


def shutdown_clib():
global clib_module
if clib_module is not None:
clib_module.shutdown()
clib_module = None


class GeoDiffLibError(Exception):
pass

Expand Down
Loading

0 comments on commit 217b537

Please sign in to comment.