From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2007-03-22 18:52:01
> Emil Dotchevski <emildotchevski_at_[hidden]> writes:
>>> OK. But that doesn't really address my initial point: implementing
>>> call_once> in terms of the POSIX pthread_once is a bit pointless if you
>>> need to implement> pthread_once separately anyway. If you don't have
>>> pthread_once, I would write> call_once (or, equivalently
>>> and implement pthread_once in> terms of that.
>> Pthread is a C interface that has been implemented on many platforms
>> and I don't see why you think anyone would implement it over std::thread.
>> just won't happen.
> ****If you don't have Pthreads available*** it might make more sense to
> implement it in terms of the (more feature-rich) C++ API than vice-versa,
> you need to write both.
It might make more sense but it just won't happen. Pthread has already been
implemented on Windows; we don't need another pthread implementation, unless
it is The Official Microsoft Implementation, which will happen only if
pthreads becomes part of the C++ standard, and that's N2178.
>> Pthread is there, standardized, proven in practice, so why not make use
>> it? In addition, there is a lot of legacy pthread code which N2178 makes
>> compatible with future C++ <thread> based code. I consider both to be
> If Pthreads is not available, then you can't make use of it.
> Having an implementation of <thread> based on <pthread.h> is a Good
> Thing. Being able to implement <thread> without <pthread.h> is also a Good
In N2178, you can implement <thread> without having <pthread.h>, by
implementing <pthread.h> first. :))
Seriously though, N2178's <thread> is a no-brainer if <pthread.h> is
available, and <pthread.h> is not harder to implement than any of the
proposed <thread> abstractions -- simply because they are all abstractions
of the same thing.
> If you don't have <pthread.h>, being able to implement <pthread.h> in
> terms of <thread> might also be a Good Thing --- if you want it, you have
> write it somehow.
Lets assume that pthread is not adopted as part of the C++ standard. In that
case, of the 2 possibilities -- rewriting existing <pthread.h> on Unix to
use <thread> and rewriting existing <pthread.h> on Windows to use
<thread> -- which one is a Good Thing?