Python API: Missing locking of results data structure. 73/4773/9
authorOle Troan <ot@cisco.com>
Thu, 19 Jan 2017 08:44:44 +0000 (09:44 +0100)
committerOle Troan <ot@cisco.com>
Fri, 20 Jan 2017 01:11:26 +0000 (02:11 +0100)
commit5016f99075a8b9c802e675aad6141bdca12175f6
tree75b6955cc24420c0425d48e0ed60fa005bfa1aa1
parentcf751ec70df21affb19c77b2c51e3c231b8202ad
Python API: Missing locking of results data structure.

The wrong assumption that the GIL combined with CPython's "mostly"
thread safe assurance does not hold. The combination of a slow
event handler for notification and calling the API at the same
time let to contention on the results data structure.

Added suitable locking.

Also added an atexit() to attempt a VPP disconnect on shutdown.

Also: lots more comments, docstrings, duplicated code removed.
Some of the problem here was a disagreement between caller
and author as to how the API should be used; the comments should
help.

Change-Id: I0cb7d0026db660ec141425c5ad474f14bacea36e
Signed-off-by: Ole Troan <ot@cisco.com>
Co-Authored-By: Ian Wells <iawells@cisco.com>
Signed-off-by: Ole Troan <ot@cisco.com>
src/vpp-api/python/vpp_papi/vpp_papi.py