I have been adding mutexes to a piece of code, but I always get the following error when I have debug checks enabled:
Code: Select all
#0 chSysHalt (reason=reason@entry=0x800e5cc <func.7893> "chSchReadyI") at ../../src/ChibiOS/os/rt/src/chsys.c:207
#1 0x0800189a in chSchReadyI (tp=0x200056ac <mac_arbiter_+860>) at ../../src/ChibiOS/os/rt/src/chschd.c:223
#2 0x08002340 in chMtxUnlock (mp=mp@entry=0x20003edc <cmd_thd+2428>) at ../../src/ChibiOS/os/rt/src/chmtx.c:383
which happens in the following code:
Code: Select all
void send(uint64_t address, msg_t* msg, bool ack)
{
_mtx.lock();
_mac.send(address, msg, ack); // Something that needs protection
_mtx.unlock();
signalEvents(1); // Wakeup the MAC data pump
}
Is there something obvious that I am missing here in the use of my mutex?
send is being called inside a thread, and _mtx is part of a class.
Using ChibiOS 17.6.x.
Thanks!