Correct connection sequence to maximize chances of e.g.: getting connected :)

Enrico Mioso mrkiko.rs at gmail.com
Thu Apr 30 14:44:32 UTC 2020


On Thu, 30 Apr 2020, Aleksander Morgado wrote:
...
> My question is, why do you really want to make sure all async
> operations are finished when the program quits. Do you truly need
> that? If you do need that, then once the program is told to quit, you
> should launch the "program cancellation logic" which would cancel the
> program-wide cancellable, and then wait until all async operations are
> finished. You may for example keep a counter of the async operations
> you're running concurrently, and once it reaches 0 (meaning all async
> operations finished) then you would be able to cleanly stop the
> mainloop at that point. Don't know, something like that.
>
...
> If the async operation doesn't support GCancellable, you cannot do
> anything. If the async operation supports GCancellable, it is
> (usually) guaranteed that the async operation will finish with a
> G_IO_ERROR_CANCELLED error. But, there is no guarantee that cancelling
> a cancellable will make the async operation actually get cancelled
> earlier! Some operations allow that (e.g. a network scan) but some
> others will just wait for the operation to finish normally but then
> returning a cancelled error instead of whatever the result of the
> async operation was.
Thank you very very much Aleksander.
Well, in my previous codebase I needed that to ensure no already freed memory was accessed.
But if I only operate on GObjects I should be fine, I guess. because any async 
operation in libmm-glib will have to take it's own object reference, so I can 
unref mine and all should be fine in the end, most of the times.

Thanks again, and sorry for the multitude of questions.


More information about the ModemManager-devel mailing list