# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# class ActorException(Exception):   #NOTE: Overview documented
#     def __init__(self, *argv, **argd):
#         super(ActorException, self).__init__(*argv)
#         self.__dict__.update(argd)


from functools import wraps as _wraps
from contextlib import contextmanager
from guild.actor import Actor, ActorException
import copy
import threading
import time
import time
    """
    def __init__(self):
        self.store = {}                # Threadsafe
        self.lock = threading.Lock()

        self.last_update = time.time() # Readonly

    # ////---------------------- Direct access -----------------------\\\\
    # Let's make this lock free, and force the assumption that to do
    # this the store must be locked.
    #
    # Let's make this clear by marking these private
    #
    # Reads Store Value - need to protect during clone
    def __get(self, key):
        """
        Retreive a value.  Returns a clone of the Value.  Not thread-safe.
        """
        return self.store[key].clone()

    # Writes Store Value - need to prevent multiple concurrent write
    def __make(self, key):
        """ Create a new key-value pair.  Not thread-safe """
        self.store[key] = Value(0, None, self, key)

    # Writes Store Value  - need to prevent multiple concurrent write
    def __do_update(self, key, value):
        """
        Update a key-value pair and increment the version.  Not thread-safe
        """

# Path: guild/actor.py
# class Actor(ActorMixin, _Thread):
#     daemon = True
# 
#     def __init__(self):
#         self.killflag = False
#         super(Actor, self).__init__()
# 
#     def run(self):
#         self.process_start()
#         self.process()
#         try:
#             gen = self.main
#         except AttributeError:
#             try:
#                 gen = self.gen_process
#             except AttributeError:
#                 gen = None
# 
#         if gen:
#             # NB next line looks at the code object, and checks a flag
#             if inspect.isgeneratorfunction(gen):
#                 g = gen()
#             else:
#                 function_name = gen.__self__.__class__.__name__ +"."+gen.__name__
#                 source_ref = "(%s, line: %d)" % (gen.__func__.__code__.co_filename, gen.__func__.__code__.co_firstlineno)
#                 warning = "Function %s %s must be a generator" % (function_name, source_ref)
#                 raise ValueError(warning)
#         else:
#             g = None
# 
#         while not self.killflag:
# 
#             while (self.F_inbound or self.inbound or self.core):
#                 self._actor_do_queued()
# 
#             if not self._actor_do_queued():
#                 if g is None:
#                     time.sleep(0.01)
#             if g:
#                 try:
#                     next(g)
#                 except StopIteration:
#                     # Print("Generator Exited")
#                     self.stop()
#                     g = None
#         self.onStop()
#         if g:
#             try:
#                 g.throw(StopIteration)
#             except StopIteration:
#                 pass
# 
#     def stop(self):
#         self.killflag = True
# 
# class ActorException(Exception):   #NOTE: Overview documented
#     def __init__(self, *argv, **argd):
#         super(ActorException, self).__init__(*argv)
#         self.__dict__.update(argd)


# Path: guild/stm.py
from functools import wraps as _wraps
from contextlib import contextmanager
from guild.actor import Actor, ActorException
import copy
import threading
import time
import time

    """
    def __init__(self):
        self.store = {}                # Threadsafe
        self.lock = threading.Lock()

        self.last_update = time.time() # Readonly

    # ////---------------------- Direct access -----------------------\\\\
    # Let's make this lock free, and force the assumption that to do
    # this the store must be locked.
    #
    # Let's make this clear by marking these private
    #
    # Reads Store Value - need to protect during clone
    def __get(self, key):
        """
        Retreive a value.  Returns a clone of the Value.  Not thread-safe.
        """
        return self.store[key].clone()

    # Writes Store Value - need to prevent multiple concurrent write
    def __make(self, key):
        """ Create a new key-value pair.  Not thread-safe """
        self.store[key] = Value(0, None, self, key)

    # Writes Store Value  - need to prevent multiple concurrent write
    def __do_update(self, key, value):
        """
        Update a key-value pair and increment the version.  Not thread-safe
        """

        if isinstance(value.value, Actor):