0

Env: Python 3.9 on RasPi OS: I am looking for a easier alternative to queueing for a threaded app. The dictionary structure (including all keys) will be initialized by main. A MQTT thread, with the dictionary as a global, would be responsible for writing the values as they arrive. The main thread would only consume these values, never change them. Is this scenario thread-safe? With the GIL it would seem to be and this is a much simpler solution than queueing but I don’t want to have to use locks if I don’t have to.

Thanks.

gprade
  • 11
  • 4
  • If the data is modified by one thread only, what problems would you expect? – Klaus D. Jan 23 '22 at 20:56
  • I expect none, hence the design. Having many years writing multi-tasked/threaded programs the pervosity of systems frequently amaze me. – gprade Jan 23 '22 at 20:58
  • I read the answers you referenced as being a duplicate - it does not answer the question that I asked. My question specifically referenced one thread only updating and another thread only reading. I'll add locks but I believe they are unnecessary. – gprade Jan 24 '22 at 02:50

0 Answers0