Re: Threads - When?
dd.foldhill@googlemail.com wrote:
How long will it be before c++ has anything to say about threads?
Richard Kavanagh
A Very Long Time, hopefully.
I think that it is possible to use C++ as it is effectively in a
multi-threaded environment, provided that good primitives to support
such an environment have been created. In particular, the
synchronization primitives are critical (no pun intended).
I know, for example, that the design of the threading model is not
arbitrary. If one is to write code that is portable and
multi-threaded, there are fundamental principles that are to be
discovered when devising the thread framework, let alone the other
classes like events, mutexes, and semaphores. In other words, simply
wrapping the OS's thread function in a class and "getting on with it"
is not sufficient.
I guess what I am trying to say is that, before C++ is design to
support threads, there remains the task of completing the model of a
thread itself, not at a low-level, but a higher-level, within any
language.
To give two hints:
1. There was a post not long about where a programmer wanted to
manually rollback the stack of another thread, essentially duplicating
what exception handling code would do.
2. There is also the recurring scenario where thread B is in the middle
of a lengthy process and thread A wants it to stop right away, but in a
clean way also.
I believe that both of these problems, if solved elegantly, would force
a fundamental reconsideration of the basic principles underlying thread
usage, and a framework supporting the new model could be implemented
entirely in C++, relatively portably, with no changes to the language.
-Le Chaud Lapin-
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]