Sujet : Re: Best (simplest) way to share data between processes
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.pythonDate : 06. Jul 2024, 13:32:53
Autres entêtes
Organisation : Stefan Ram
Message-ID : <mutex-20240706123143@ram.dialup.fu-berlin.de>
References : 1
Chris Green <
cl@isbd.net> wrote or quoted:
Would a mutex of some sort around each I2C transaction (i.e. complete
A2D reading) be a better way to go?
I not an expert here, but from what I heard, you could use
a named POSIX semaphore as a kind of system-wide mutex.
Or, the single process reading the A2D values could write
them to a shared memory segment the access to which is
controlled by a mutex.
Or, you could use a message queue (like POSIX mq) to
distribute readings.
But why overengineer? If you feel comfortable with the file
solution, go for it! The only drawback might be that it's a
bit slower than other approaches.