# Path: evergreen/event.py
# class Event(object):
# 
#     def __init__(self):
#         self._cond = Condition(Lock())
#         self._flag = False
# 
#     def is_set(self):
#         return self._flag
# 
#     def set(self):
#         self._cond.acquire()
#         try:
#             self._flag = True
#             self._cond.notify_all()
#         finally:
#             self._cond.release()
# 
#     def clear(self):
#         self._cond.acquire()
#         try:
#             self._flag = False
#         finally:
#             self._cond.release()
# 
#     def wait(self, timeout=None):
#         self._cond.acquire()
#         try:
#             signaled = self._flag
#             if not signaled:
#                 signaled = self._cond.wait(timeout)
#             return signaled
#         finally:
#             self._cond.release()
# 
# Path: evergreen/locks.py
# class Lock(Semaphore):
# 
#     def __init__(self):
#         super(Lock, self).__init__(value=1)


import six
from evergreen.event import Event
from evergreen.locks import Lock
#
# This file is part of Evergreen. See the NOTICE for more information.
#



__all__ = ['Channel']


class _Bomb(object):

    def __init__(self, exp_type, exp_value=None, exp_traceback=None):
        self.type = exp_type
        self.value = exp_value if exp_value is not None else exp_type()
        self.traceback = exp_traceback

    def raise_(self):
        six.reraise(self.type, self.value, self.traceback)


class Channel(object):

    def __init__(self):
        self._send_lock = Lock()
        self._recv_lock = Lock()

# Path: evergreen/event.py
# class Event(object):
# 
#     def __init__(self):
#         self._cond = Condition(Lock())
#         self._flag = False
# 
#     def is_set(self):
#         return self._flag
# 
#     def set(self):
#         self._cond.acquire()
#         try:
#             self._flag = True
#             self._cond.notify_all()
#         finally:
#             self._cond.release()
# 
#     def clear(self):
#         self._cond.acquire()
#         try:
#             self._flag = False
#         finally:
#             self._cond.release()
# 
#     def wait(self, timeout=None):
#         self._cond.acquire()
#         try:
#             signaled = self._flag
#             if not signaled:
#                 signaled = self._cond.wait(timeout)
#             return signaled
#         finally:
#             self._cond.release()
# 
# Path: evergreen/locks.py
# class Lock(Semaphore):
# 
#     def __init__(self):
#         super(Lock, self).__init__(value=1)


# Path: evergreen/channel.py
import six
from evergreen.event import Event
from evergreen.locks import Lock

#
# This file is part of Evergreen. See the NOTICE for more information.
#



__all__ = ['Channel']


class _Bomb(object):

    def __init__(self, exp_type, exp_value=None, exp_traceback=None):
        self.type = exp_type
        self.value = exp_value if exp_value is not None else exp_type()
        self.traceback = exp_traceback

    def raise_(self):
        six.reraise(self.type, self.value, self.traceback)


class Channel(object):

    def __init__(self):
        self._send_lock = Lock()
        self._recv_lock = Lock()

        self._new_data = Event()