Are you doing that?
If so, you have to put a mutex around grovepi access.
Are you doing that?
If so, you have to put a mutex around grovepi access.
Correct me if I am wrong, but didnât Cleoqc say that - by default - mutexes are not used, but there is a setting somewhere, (I think it was something like âmutex = trueâ that would default everything to using mutexes?
I remember saying that if itâs such a desirable thing, why isnât it the default - and your reply was that âitâs a part of the pedagogyâ. (And then I made a snarky comment that went something like âif jumping off a building is a bad idea, does that mean we should do it, just to learn not to do it?â Â
I canât find it right now - do you remember that posting?
That is for EasyGoPiGo3() only.
grovepi is not a class, and does not offer mutex protected methods. The user must either put all grovepi accesses in a single thread and use a thread_lock, or create a mutex protected grovepi class, or create a mutex, and use it:
import threading
gplock = threading.Lock()
.
.
def any_func_that_accesses_grovepi()
global gplock
with gplock:
grovepi.xxx()
If it is the I2C of grovepi that you are worried about, then you can use the dexter I2C_mutex:
from I2C_mutex import Mutex
.
.
gpmutex = Mutex() # or Mutex(debug=True)
.
.
.
def any_func_that_uses_grovepi()
global gpmutex
with gpmutex:
grovepi.xxxx()