|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-08-03 05:16:08
Jonathan Wakely <cow_at_[hidden]> writes:
> Jonathan Turkanis wrote:
>
>> Pavel Vozenilek wrote:
>> > "Jason Hise" wrote:
>> >
>> >>> http://www.boost.org/doc/html/call_once.html?
>> >>>
>> >> Why does it require that the function which is called once not be
>> >> allowed to throw? I am not sure that I can meet this requirement,
>> >> as I may need to dynamically allocate memory.
>> >>
>> > Possibly because of internal implementation.
>>
>> I think it's a pthreads requirement.
>
> Pthreads knows nothing about exceptions, so it can't strictly require
> that one isn't thrown :-)
It's also a 'C' library so *in general* it can't propagate an
exception properly either. I'm pretty sure that's the reason for the
requirement. In principle, it might crash. Of course, some systems
have integrated C++ exceptions with their 'C' runtime and libraries.
In fact, pthreads is more likely than most libraries to have
registered the appropriate 'C' cleanups, because pthreads has a whole
integrated cancellation mechanism that is intended to map to C++
exceptions.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk