Skip to content

Commit

Permalink
finalize thread wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
rlehfeld committed Sep 3, 2024
1 parent b5da874 commit 7756ae6
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions RPyCRobotRemote/RPyCRobotRemoteServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
class WrapTheadSpecific:
"""generic wrapper for any kind of object which makes it thread specific"""

# defined in object base class. To complete the wrapper, we must
# define all of these additionally
# ['__getattribute__', '__init_subclass__',
# '__reduce__', '__reduce_ex__']

def __init__(self, default=None):
super().__setattr__('_local', threading.local())
super().__setattr__('_default', default)
Expand Down Expand Up @@ -72,6 +67,12 @@ def __setattr__(self, item, value):
def __delattr__(self, item):
return delattr(self.get_thread_specific_instance(), item)

def __reduce__(self):
return self.get_thread_specific_instance().__reduce__()

def __reduce_ex__(self, protocol):
return self.get_thread_specific_instance().__reduce_ex__(protocol)

def __format__(self, format_spec):
return self.get_thread_specific_instance().__format__(format_spec)

Expand Down

0 comments on commit 7756ae6

Please sign in to comment.