From f93efaaa7c7f44d7f5d66bad97fde91d5ad3e082 Mon Sep 17 00:00:00 2001 From: Rod Kay Date: Wed, 4 Sep 2024 20:29:08 +1000 Subject: [PATCH] lace.event_connector.destruct: Revamp 'all_Connectors_are_idle'. --- .../source/events/lace-event_connector.adb | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/1-base/lace/source/events/lace-event_connector.adb b/1-base/lace/source/events/lace-event_connector.adb index 82806de..c7546d1 100644 --- a/1-base/lace/source/events/lace-event_connector.adb +++ b/1-base/lace/source/events/lace-event_connector.adb @@ -30,6 +30,8 @@ is procedure add (new_Connector : in Connector_view); procedure get ( a_Connector : out Connector_view); + function Length return ada.Containers.Count_type; + private all_Connectors : connector_Vector; end safe_Connectors; @@ -143,18 +145,20 @@ is function all_Connectors_are_idle return Boolean is - Result : Boolean := True; + use type ada.Containers.Count_type; + -- Result : Boolean := True; begin - for Each of all_Connectors - loop - if not Each'Callable - then - Result := False; - exit; - end if; - end loop; - - return Result; + return all_Connectors.Length = idle_Connectors.Length; + -- for Each of all_Connectors + -- loop + -- if not Each'Callable + -- then + -- Result := False; + -- exit; + -- end if; + -- end loop; + -- + -- return Result; end all_Connectors_are_idle; @@ -292,8 +296,8 @@ is - ------------------ - --- Safe emitters. + -------------------- + --- Safe connectors. -- protected body safe_Connectors @@ -320,6 +324,13 @@ is end get; + function Length return ada.Containers.Count_type + is + begin + return all_Connectors.Length; + end Length; + + end safe_Connectors;