summaryrefslogtreecommitdiff
path: root/cloudinit/type_utils.py
diff options
context:
space:
mode:
authorRyan Harper <ryan.harper@canonical.com>2018-08-31 21:47:18 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2018-08-31 21:47:18 +0000
commit43e51a04515686a15c410d1a16dd5ff06fd1afd4 (patch)
tree4ad8fb33fc749669f7a1ef583cfe82979b207bb2 /cloudinit/type_utils.py
parent9c35f9762028b8bf15cdcd6b42c0fafc233ddda3 (diff)
downloadvyos-cloud-init-43e51a04515686a15c410d1a16dd5ff06fd1afd4.tar.gz
vyos-cloud-init-43e51a04515686a15c410d1a16dd5ff06fd1afd4.zip
hyperv_reporting_handler: simplify threaded publisher
Switch the implementation to a daemon thread which uses a blocking get from the Queue. No additional locking or flag checking is needed since the Queue itself handles acquiring the lock as needed. cloud-init only has a single producer (the main thread calling publish) and the consumer will read all events in the queue and write them out. Using the daemon mode of the thread handles flushing the queue on main exit in python3; in python2.7 we handle the EOFError that results when the publish thread calls to get() fails indicating the main thread has exited. The result is that the handler is no longer spawing a thread on each publish event but rather creates a single thread when we start up the reporter and we remove any additional use of separate locks and flags as we only have a single Queue object and we're only calling queue.put() from main thread and queue.get() from consuming thread.
Diffstat (limited to 'cloudinit/type_utils.py')
0 files changed, 0 insertions, 0 deletions