Serial port and GPS

FormWithInvoke.doStop Method 

Stop gently the process

[Visual Basic]
Protected Function doStop( _
   ByVal aStopCb As StopCb _
) As Boolean
[C#]
protected bool doStop(
   StopCb aStopCb
);

Parameters

aStopCb
the stop procedure, if null, then nothing is called, but the remaining part of the logic (setting m_losing to true and waiting until m_invoked becomes false) is still execured.

Return Value

true, if everything went OK and Invoke() finished during the call to this method, ie. m_invoked became 0. false if m_invoked was 1 the whole time, in this case call this method again and again until it succeeds, show an error messsage or thing about speeding up procedures called with doInvoke().

Remarks

Calls the given stop procedure only, if no invokes are active. The given stop procedure usually contains calls to Thread.Join(), which, if called simultaneously with Invoke(), would cause hangs of the program. Therefore the procedure waits, calling Application.doEvents() maximally MAX_STOP_TRIES, until the flag m_invoked becomes false.

See Also

FormWithInvoke Class | serial Namespace