Exemple #1
0
def test_set_thread_state():
    with set_thread_state(x=1):
        assert thread_state.x == 1

    assert not hasattr(thread_state, "x")
Exemple #2
0
 def cb(self):
     while True:
         x = yield self.queue.get(asynchronous=True)
         with set_thread_state(asynchronous=True):
             result = self.emit(x)
         yield result
Exemple #3
0
 def _update(self, x, who=None):
     client = default_client()
     result = yield client.gather(x, asynchronous=True)
     with set_thread_state(asynchronous=True):
         result = self.emit(result)
     yield result
Exemple #4
0
def test_set_thread_state():
    with set_thread_state(x=1):
        assert thread_state.x == 1

    assert not hasattr(thread_state, 'x')