Boost logo

Boost :

From: Howard Hinnant (howard.hinnant_at_[hidden])
Date: 2007-08-27 09:57:43


On Aug 27, 2007, at 9:45 AM, Peter Dimov wrote:

> Howard Hinnant:
>
>> On Aug 21, 2007, at 5:14 PM, Peter Dimov wrote:
>>
>>> void __cndcheck_init( void * pc, void * pm )
>>> {
>>> __cndcheck_state[ (size_t)pc % 17041 ] = { pc, pm }; // atomic
>>> store
>>> }
>>
>> So what do you do about collisions?
>
> Nothing; if there's a collision, I miss the opportunity to check. The
> "permissive" spec allows me to do that. If I had to throw on mutex
> mismatch,
> this implementation would be non-conforming. I can tune the magic
> number
> 17041 to strike the best ratio of accuracy vs space, and I can vary it
> slightly on each run to redistribute the collisions.

Don't we have false positives now?

Thread A Thread B

std::condition cv1(0);
                                   std::condition cv2(&mut2); //
cv2 collides with cv1
cv1.wait(mut1); // asserts

It appears to me that we have a random process abort involving a
condition that asked for no checking.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk