[MERGED] osmo-gsm-tester[master]: modem: reset cancellable after cancelling dbus methods

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Oct 6 10:08:00 UTC 2017


Pau Espin Pedrol has submitted this change and it was merged.

Change subject: modem: reset cancellable after cancelling dbus methods
......................................................................


modem: reset cancellable after cancelling dbus methods

I first wanted to use "reset" method, but according to [1]:
"The recommended practice is to drop the reference to a
cancellable after cancelling it, and let it die with the outstanding
async operations. You should create a fresh cancellable for further
async operations."

Pretty weird that in other parts of documentation it still says that it
can be used for concurrent events.

[1] https://developer.gnome.org/gio/2.54/GCancellable.html#g-cancellable-reset

Change-Id: I7392275620576fd0037be5b9d9f360a46a4f8312
---
M src/osmo_gsm_tester/ofono_client.py
1 file changed, 2 insertions(+), 0 deletions(-)

Approvals:
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo_gsm_tester/ofono_client.py b/src/osmo_gsm_tester/ofono_client.py
index 30e2b55..e301ed6 100644
--- a/src/osmo_gsm_tester/ofono_client.py
+++ b/src/osmo_gsm_tester/ofono_client.py
@@ -502,6 +502,8 @@
         # Cancel op is applied as a signal coming from glib mainloop, so we
         # need to run it and wait for the callbacks to handle cancellations.
         poll_glib()
+        # once it has been triggered, create a new one for next operation:
+        self.cancellable = Gio.Cancellable.new()
 
     def power_cycle(self):
         'Power the modem and put it online, power cycle it if it was already on'

-- 
To view, visit https://gerrit.osmocom.org/4145
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7392275620576fd0037be5b9d9f360a46a4f8312
Gerrit-PatchSet: 2
Gerrit-Project: osmo-gsm-tester
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list