Hi,
I just tried to use the C++ wrapper for mutexes and was surprised when I didn't find any methods to unlock it.
It's no problem since the wrapper class just calls the chMtx... functions, but shouldn't a wrapper cover ALL the available functions?
Is there a reason why no unlock methods are provided?
If not, I will gladly create a patch
Thargon
chibios_rt::Mutex no unlock methods
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: chibios_rt::Mutex no unlock methods
Hi,
If I remember well it is a method of the thread object because it intrinsically operates on the last mutex taken.
Propose your patch, it is not set in stone.
Giovanni
If I remember well it is a method of the thread object because it intrinsically operates on the last mutex taken.
Propose your patch, it is not set in stone.
Giovanni
Re: chibios_rt::Mutex no unlock methods
Thargon, is this the code you are talking about?
This code has been in ChibiOS ch.cpp/ch.hpp since Aug 2014.
Code: Select all
void Mutex::unlock(void) {
chMtxUnlock(&mutex);
}
void Mutex::unlockS(void) {
chMtxLockS(&mutex);
}
This code has been in ChibiOS ch.cpp/ch.hpp since Aug 2014.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
-
- Posts: 135
- Joined: Wed Feb 04, 2015 5:03 pm
- Location: CITEC, Bielefeld University, germany
- Has thanked: 15 times
- Been thanked: 24 times
- Contact:
Re: chibios_rt::Mutex no unlock methods
Strange...
In the online documentation there are no such methods.
In my cloned version (2.6.7) these are missing as well.
Maybe the code is included in 3.0 but missing for 2.x.x?
However, the snippet provided by colin should do the job.
In the online documentation there are no such methods.
In my cloned version (2.6.7) these are missing as well.
Maybe the code is included in 3.0 but missing for 2.x.x?
However, the snippet provided by colin should do the job.
Re: chibios_rt::Mutex no unlock methods
colin wrote:Thargon, is this the code you are talking about?Code: Select all
void Mutex::unlock(void) {
chMtxUnlock(&mutex);
}
void Mutex::unlockS(void) {
chMtxLockS(&mutex);
}
This code has been in ChibiOS ch.cpp/ch.hpp since Aug 2014.
Yikes, I think this is a bad bug: It seems that Mutex::unlockS() should call chMtxUnlockS() and not chMtxLockS() again.
- Giovanni
- Site Admin
- Posts: 14455
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Who is online
Users browsing this forum: No registered users and 6 guests