Python API: Missing locking of results data structure. 96/4796/1
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 00:49:04 +0000 (01:49 +0100)
commit7104f93c75aacb97df8c2c5388ef2f1164ce7403
tree9d32fae841dc737a75613134548b3f9d38934d13
parent12713c70fc8c0a0aa92cdbc42c98bac8932f2d63
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>
vpp-api/python/vpp_papi/vpp_papi.py