diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-04-03 09:40:49 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-04-03 09:40:49 +0000 |
commit | 030fe1d90878c6bcdfe771e4d933e859ca023698 (patch) | |
tree | ba9ff9c6f1aaf991cf9a41d3585227dfcb90e46e /os/rt/src/chmtx.c | |
parent | b360a11a9648e9e656b9b907814229f8e113f9e5 (diff) | |
download | ChibiOS-030fe1d90878c6bcdfe771e4d933e859ca023698.tar.gz ChibiOS-030fe1d90878c6bcdfe771e4d933e859ca023698.tar.bz2 ChibiOS-030fe1d90878c6bcdfe771e4d933e859ca023698.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7846 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt/src/chmtx.c')
-rw-r--r-- | os/rt/src/chmtx.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/os/rt/src/chmtx.c b/os/rt/src/chmtx.c index deffb397d..03f78a3ce 100644 --- a/os/rt/src/chmtx.c +++ b/os/rt/src/chmtx.c @@ -107,7 +107,7 @@ void chMtxObjectInit(mutex_t *mp) { queue_init(&mp->m_queue);
mp->m_owner = NULL;
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 0;
+ mp->m_cnt = (cnt_t)0;
#endif
}
@@ -146,7 +146,7 @@ void chMtxLockS(mutex_t *mp) { if (mp->m_owner != NULL) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
/* If the mutex is already owned by this thread, the counter is increased
and there is no need of more actions.*/
@@ -218,13 +218,13 @@ void chMtxLockS(mutex_t *mp) { chDbgAssert(mp->m_owner == ctp, "not owner");
chDbgAssert(ctp->p_mtxlist == mp, "not owned");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 1, "counter is not one");
+ chDbgAssert(mp->m_cnt == (cnt_t)1, "counter is not one");
}
#endif
}
else {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 0, "counter is not zero");
+ chDbgAssert(mp->m_cnt == (cnt_t)0, "counter is not zero");
mp->m_cnt++;
#endif
@@ -287,7 +287,7 @@ bool chMtxTryLockS(mutex_t *mp) { if (mp->m_owner != NULL) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
if (mp->m_owner == currp) {
mp->m_cnt++;
@@ -298,7 +298,7 @@ bool chMtxTryLockS(mutex_t *mp) { }
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt == 0, "counter is not zero");
+ chDbgAssert(mp->m_cnt == (cnt_t)0, "counter is not zero");
mp->m_cnt++;
#endif
@@ -331,9 +331,9 @@ void chMtxUnlock(mutex_t *mp) { chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
- if (--mp->m_cnt == 0) {
+ if (--mp->m_cnt == (cnt_t)0) {
#endif
chDbgAssert(ctp->p_mtxlist == mp, "not next in list");
@@ -369,7 +369,7 @@ void chMtxUnlock(mutex_t *mp) { /* Awakens the highest priority thread waiting for the unlocked mutex and
assigns the mutex to it.*/
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -411,9 +411,9 @@ void chMtxUnlockS(mutex_t *mp) { chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- chDbgAssert(mp->m_cnt >= 1, "counter is not positive");
+ chDbgAssert(mp->m_cnt >= (cnt_t)1, "counter is not positive");
- if (--mp->m_cnt == 0) {
+ if (--mp->m_cnt == (cnt_t)0) {
#endif
chDbgAssert(ctp->p_mtxlist == mp, "not next in list");
@@ -449,7 +449,7 @@ void chMtxUnlockS(mutex_t *mp) { /* Awakens the highest priority thread waiting for the unlocked mutex and
assigns the mutex to it.*/
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -486,7 +486,7 @@ void chMtxUnlockAll(void) { ctp->p_mtxlist = mp->m_next;
if (chMtxQueueNotEmptyS(mp)) {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 1;
+ mp->m_cnt = (cnt_t)1;
#endif
thread_t *tp = queue_fifo_remove(&mp->m_queue);
mp->m_owner = tp;
@@ -496,7 +496,7 @@ void chMtxUnlockAll(void) { }
else {
#if CH_CFG_USE_MUTEXES_RECURSIVE == TRUE
- mp->m_cnt = 0;
+ mp->m_cnt = (cnt_t)0;
#endif
mp->m_owner = NULL;
}
|