[SDL] Incoherent mutex behavior in Windows/Linux

David Olofson david.olofson at reologica.se
Fri Jun 14 07:21:01 PDT 2002


On Thu, 13/06/2002 16:05:27 , Ryan C. Gordon <icculus at clutteredmind.org> wrote:
>
>> >Not that you aren't correct, but as a rule of thumb if you are unlocking
>> >a mutex more than you are locking it, you may be in trouble in your threaded
>> >code design.
>>
>> Yes. Unlock only what you lock, and you should be fine.
>>
>> Either way, maybe it would be a good idea to point out in the docs
>> that unlocking an unlocked mutex is an error, and that the behavior is
>> undefined? (That way, no one can claim it's a bug... ;-)
>
>Well, what should it be? Error or success to unlock an unlocked mutex?

If it's undefined, it's... well, undefined! :-)

That said, it might make debugging easier if behavior is as concistent as possible accross platforms. (Not everyone can test on all platforms regularly.)


//David


.---------------------------------------
| David Olofson
| Programmer
| david.olofson at reologica.se
|---------------------------------------
| Address:
| REOLOGICA Instruments AB
| Scheelevägen 30
| 223 63 LUND
| Sweden
|---------------------------------------
| Phone: 046-12 77 60
| Fax: 046-12 50 57
| Mobil: 
| E-mail: david.olofson at reologica.se
| WWW: http://www.reologica.se
| 
`-----> We Make Rheology Real





More information about the SDL mailing list