Page 1 of 1

Any reason for dropping functions from guarded pools?  Topic is solved

Posted: Mon Mar 11, 2019 6:35 am
by FXCoder
Were these dropped for any reason from chmempools.h when os/lib became os/oslib?

Code: Select all


/**
 * @brief   Gets the count of objects in a guarded memory pool.
 * @pre     The guarded memory pool must be already been initialized.
 *
 * @param[in] gmp       pointer to a @p guarded_memory_pool_t structure
 *
 * @iclass
 */
static inline cnt_t chGuardedPoolGetCounterI(guarded_memory_pool_t *gmp) {

  return chSemGetCounterI(&gmp->sem);
}

/**
 * @brief   Resets the guarded memory pool.
 * @pre     The guarded memory pool must be already been initialized.
 * @post    Any threads waiting on the pool receive the MSG_RESET.
 * @post    The pool counter is set to the supplied value.
 *
 * @param[in] gmp       pointer to a @p guarded_memory_pool_t structure
 * @param[in] n         the new value of the pool counter. The value must
 *                      be non-negative.
 * @iclass
 */
static inline void chGuardedPoolResetI(guarded_memory_pool_t *gmp, cnt_t n) {

  chSemResetI(&gmp->sem, n);
}

Re: Any reason for dropping functions from guarded pools?

Posted: Mon Mar 11, 2019 6:44 am
by Giovanni
The reset function is simply wrong but the get counter looks OK, probably a mistake on my side, I don't remember removing it. I will reintroduce it.

Giovanni

Re: Any reason for dropping functions from guarded pools?

Posted: Mon Mar 11, 2019 12:49 pm
by Giovanni
I re-added the get counter to trunk and 19.1.x.

Giovanni

Re: Any reason for dropping functions from guarded pools?

Posted: Mon Mar 11, 2019 2:14 pm
by FXCoder
Thanks.
I was using the get counter in an assert to check if all pool members were released prior to destroying the pool.
I’ll resurrect that assert now.