Skip to content

Commit

Permalink
Fixed a bug where, upon switching to a threaded context with an alrea…
Browse files Browse the repository at this point in the history
…dy running thread, the thread would be ignored
  • Loading branch information
CRImier committed Apr 14, 2018
1 parent 1665bdc commit 103e7e3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,12 @@ def activate(self):
an exception if it detects that a supposedly non-threaded context has the ``threaded``
flag set.
"""
if self.is_threaded() and not self.thread_is_active():
self.verify_target()
self.start_thread()
if self.is_threaded():
if not self.thread_is_active():
self.verify_target()
self.start_thread()
else:
logger.debug("A thread for the {} context seems to already be active, not doing anything".format(self.name))
else:
if self.name == "main":
logger.debug("Main context does not have thread target, that is to be expected")
Expand Down

0 comments on commit 103e7e3

Please sign in to comment.