Re: std::terminate per thread - std vs. MS practice?
Am 01.04.2011 00:33, schrieb Martin B.:
Hi!
Since C++ never talked about threads, MS was quite free to specify[1]:
set_terminate (CRT)
-------------------
(Visual Studio 2010 )
Installs your own termination routine
to be called by terminate.
...
In a multithreaded environment, terminate
functions are maintained separately for each
thread. Each new thread needs to install its
own terminate function. Thus, each thread is
in charge of its own termination handling.
Now, looking at the latest std draft (N3242):
18.8.3.1 Type terminate_handler
2 Required behavior: A terminate_handler shall
terminate execution of the program without
returning to the caller.
Does anyone have any idea whether the wording for the
terminate_handler might be too strict now that we have threads in the
std?
The wording of the current draft reflects the intention
of the committee that there shall be no data race and
no per-thread local terminate handler, see the proposal
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3189.htm
which became accepted in Batavia 2010. Per-thread handlers are often
hard to manage and it is always possible to define a single handler
that again queries a thread-local to get the actual handler, if you
really want, but not vice versa.
HTH & Greetings from Bremen,
Daniel Kr?gler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]