apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lucian Adrian Grijincu <lucian.griji...@avira.com>
Subject Re: New Vista APIs
Date Mon, 15 Jan 2007 09:21:25 GMT
William A. Rowe, Jr. wrote:
> Lucian Adrian Grijincu wrote:
>   
>> Let's suppose that we have apr_thread_rwlock_create2
>> (apr_thread_rwlock_t **rwlock,
>>                                                                        
>>                apr_int32_t flag,
>>                                                                        
>>                apr_pool_t *pool).
>>
>> and we define two flags to create separate types of objects:
>> apr_thread_rwlock_t which can and which cannot be used in trylock calls.
>> the performance of the ones which cannot be used in tyolock calls will
>> be the same on all platforms except for Vista, where we should see some
>> sort of improvement.
>>     
>
> We have this elsewhere in our locking API.  It seems like an awkward
> construct if we use an APR_BLOCKING flag, since it wouldn't be obvious
> to the casual programmer that it means "we won't _trylock".
>
> Maybe a create flag APR_TRYLOCK_MAY_BLOCK?
>   
I was thinking more in the realm of APR_TRYLOCK_WILL_FAIL:
a.) WILL because we'd want a similar behavior on all platforms
(portability, no?). If we use this API
       on Vista we'll either block or return an error (APR_EINVAL ...
invalid apr_thread_rwlock_t
       used with the _trylock function). The code must behave the same
on unices and the rest.
b.) FAIL because blocking:
        1) is harder to implement than a return error :)
        2) violates the contract of the _trylock function

--
Lucian Adrian Grijincu



Mime
View raw message