Skip to content

Commit

Permalink
Add a "is_running" flag to brian2.core.network
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Stimberg committed Sep 11, 2013
1 parent 4a0f6e9 commit b1ef461
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion brian2/core/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@

__all__ = ['Network']


logger = get_logger(__name__)

#: A global flag stating whether the network is currently running
is_running = False


class Network(Nameable):
'''
Expand Down Expand Up @@ -348,6 +352,9 @@ def run(self, duration, report=None, report_period=60*second,
if report is not None:
start = current = time.time()
next_report_time = start + 10

global is_running
is_running = True
while clock.running and not self._stopped and not Network._globally_stopped:
# update the network time to this clocks time
self.t_ = clock.t_
Expand All @@ -371,7 +378,9 @@ def run(self, duration, report=None, report_period=60*second,
# with the smallest t value, unless there are several with the
# same t value in which case we update all of them
clock, curclocks = self._nextclocks()


is_running = False

self.t = t_end

if report is not None:
Expand Down

0 comments on commit b1ef461

Please sign in to comment.