summaryrefslogtreecommitdiff
path: root/distbuild/mainloop.py
diff options
context:
space:
mode:
Diffstat (limited to 'distbuild/mainloop.py')
-rw-r--r--distbuild/mainloop.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/distbuild/mainloop.py b/distbuild/mainloop.py
index f0e5eebc..97e439f3 100644
--- a/distbuild/mainloop.py
+++ b/distbuild/mainloop.py
@@ -1,6 +1,6 @@
# mainloop/mainloop.py -- select-based main loop
#
-# Copyright (C) 2012, 2014 Codethink Limited
+# Copyright (C) 2012, 2014-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -56,7 +56,10 @@ class MainLoop(object):
def remove_state_machine(self, machine):
logging.debug('MainLoop.remove_state_machine: %s' % machine)
self._machines.remove(machine)
-
+
+ def n_state_machines_of_type(self, machine_type):
+ return len([m for m in self._machines if isinstance(m, machine_type)])
+
def add_event_source(self, event_source):
logging.debug('MainLoop.add_event_source: %s' % event_source)
self._sources.append(event_source)