Boost logo

Boost :

From: John Maddock (John_Maddock_at_[hidden])
Date: 2000-09-09 06:05:55


>this is the same argumnet as with c stream/file handling and c++ stream
>classes/functions. it's recommended to use the c++ safe stream library,
>BUT the user/programer CAN use the old functions if he likes it. the
>result is that the current situation give a safe way without loose the
>performance AND a not-so-safe way but with additional functionality.

No it's not the same argument at all, a scoped io stream will clean up
after itself when an exception is thrown, the aim of the auto_lock (or
whatever you want to call it) is to provide the same kind of exception
safety to threads - something that simply does not exist if you add public
lock/unlock members to the mutex. BTW the programmer can still do things
the old fahioned way if (s)he wants - by using platform native API's. I am
very much against providing direct access to lock/unlock on the mutex
itself, I think that this is a question of education, and getting the
ideoms used more widely known IMO.

- John.


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