@@ -593,10 +593,12 @@ POP_WARNING()
593593 return (result);
594594 }
595595
596- inline bool Flush (const bool abort = false )
596+ inline void Flush ()
597597 {
598598 bool result = false ;
599599
600+ TRACE_L1 (" Flushing the IPC mechanims. %d" , __LINE__);
601+
600602 _lock.Lock ();
601603
602604 _callback = nullptr ;
@@ -606,16 +608,35 @@ POP_WARNING()
606608 result = true ;
607609 }
608610
609- if ((_abort == true ) || (abort == true )) {
611+ if (_inbound.IsValid () == true ) {
612+ _inbound.Release ();
613+ result = true ;
614+ }
610615
611- TRACE_L1 ( " Flushing the IPC mechanims. %d " , __LINE__ );
616+ _lock. Unlock ( );
612617
613- if (_inbound.IsValid () == true ) {
614- _inbound.Release ();
615- }
618+ return (result);
619+ }
616620
617- result = true ;
621+ inline uint32_t Finalize (const uint32_t status)
622+ {
623+ uint32_t result = status;
624+
625+ _lock.Lock ();
626+
627+ if (_abort == true ) {
628+ Flush ();
618629 _abort = false ;
630+ result = Core::ERROR_ASYNC_FAILED;
631+ }
632+ else if (_outbound.IsValid () == true ) {
633+ ASSERT (status != Core::ERROR_NONE);
634+ ASSERT (_callback != nullptr );
635+ _callback = nullptr ;
636+ _outbound.Release ();
637+ }
638+ else {
639+ ASSERT (_callback == nullptr );
619640 }
620641
621642 _lock.Unlock ();
@@ -860,18 +881,8 @@ POP_WARNING()
860881 public:
861882 uint32_t Wait (const uint32_t waitTime)
862883 {
863- uint32_t result = Core::ERROR_NONE;
864-
865884 // Now we wait for ever, to get a signal that we are done :-)
866- if (_signal.Lock (waitTime) != Core::ERROR_NONE) {
867- _administration.Flush ();
868-
869- result = Core::ERROR_TIMEDOUT;
870- } else if (_administration.Flush () == true ) {
871- result = Core::ERROR_ASYNC_FAILED;
872- }
873-
874- return (result);
885+ return (_administration.Finalize (_signal.Lock (waitTime)));
875886 }
876887 void Dispatch (IIPC& /* element */ ) override
877888 {
@@ -997,7 +1008,7 @@ POP_WARNING()
9971008
9981009 uint32_t Execute (const ProxyType<IIPC>& command, IDispatchType<IIPC>* completed) override
9991010 {
1000- uint32_t success = Core::ERROR_UNAVAILABLE ;
1011+ uint32_t success = Core::ERROR_NONE ;
10011012
10021013 _serialize.Lock ();
10031014
@@ -1011,10 +1022,9 @@ POP_WARNING()
10111022
10121023 if (_link.IsOpen () == true ) {
10131024 _link.Submit (command->IParameters ());
1014-
1015- success = Core::ERROR_NONE;
1016- } else {
1017- _administration.Flush (true );
1025+ }
1026+ else {
1027+ _administration.Flush ();
10181028
10191029 success = Core::ERROR_CONNECTION_CLOSED;
10201030 }
@@ -1042,9 +1052,7 @@ POP_WARNING()
10421052 success = sink.Wait (waitTime);
10431053 }
10441054 else {
1045- _administration.Flush (true );
1046-
1047- success = Core::ERROR_CONNECTION_CLOSED;
1055+ _administration.Flush ();
10481056 }
10491057
10501058 _serialize.Unlock ();
0 commit comments