On 04/06/2018 09:53 AM, yla...@apache.org wrote:
> Author: ylavic
> Date: Fri Apr  6 07:53:02 2018
> New Revision: 1828492
> 
> URL: http://svn.apache.org/viewvc?rev=1828492&view=rev
> Log:
> reslist: follow up to r1828289: enfore empty list requirement when setting 
> fifo.
> 
> The doxygen remark wasn't enough as noted by Ruediger.
> 
> 
> Modified:
>     apr/apr/trunk/include/apr_reslist.h
>     apr/apr/trunk/util-misc/apr_reslist.c
> 

> 
> Modified: apr/apr/trunk/util-misc/apr_reslist.c
> URL: 
> http://svn.apache.org/viewvc/apr/apr/trunk/util-misc/apr_reslist.c?rev=1828492&r1=1828491&r2=1828492&view=diff
> ==============================================================================
> --- apr/apr/trunk/util-misc/apr_reslist.c (original)
> +++ apr/apr/trunk/util-misc/apr_reslist.c Fri Apr  6 07:53:02 2018
> @@ -445,9 +445,15 @@ APR_DECLARE(void) apr_reslist_timeout_se
>      reslist->timeout = timeout;
>  }
>  
> -APR_DECLARE(void) apr_reslist_fifo_set(apr_reslist_t *reslist, int fifo)
> +APR_DECLARE(apr_status_t) apr_reslist_fifo_set(apr_reslist_t *reslist,
> +                                               int fifo)
>  {
> +    if (!APR_RING_EMPTY(&reslist->avail_list, apr_res_t, link)) {

Don't we need to lock if want to do this or is this sufficiently atomic?
Further on don't we need to make the check and the setting of reslist->fifo 
atomic, hence both done while we hold the lock?

> +        return APR_EBUSY;
> +    }
> +
>      reslist->fifo = fifo;
> +    return APR_SUCCESS;
>  }
>  

Regards

RĂ¼diger

Reply via email to