Re: [boost] Boost.Threads, N2178, N2184, et al

<snip> 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 pthread_once2_np), and implement pthread_once in> terms of that. Pthread is a C interface that has been implemented on many platforms already and I don't see why you think anyone would implement it over std::thread. It just won't happen.
On the other hand, if a particular platform implements pthread (virtually all do, and we have Windows port of pthread which is a proof of concept at least), implementing the C++ portion of N2178 is a breeze. Pthread is there, standardized, proven in practice, so why not make use of 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 Good Things. Emil Dotchevski _________________________________________________________________ It’s tax season, make sure to follow these few simple tips http://articles.moneycentral.msn.com/Taxes/PreparationTips/PreparationTips.a...

-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Emil Dotchevski
Pthread is there, standardized, proven in practice, so why not make use of 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 Good Things.
Some of the most annoying problems in C++ directly stem from being compatible with C :-/

Sohail Somani wrote:
-----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Emil Dotchevski
Pthread is there, standardized, proven in practice, so why not make use of 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 Good Things.
Some of the most annoying problems in C++ directly stem from being compatible with C :-/
On a syntactic level. On the other hand, one important reason for C++ to be so successful and hold its own against Java and C# is its ability to interoperate with C code and libraries.

Emil Dotchevski <emildotchevski@hotmail.com> 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 pthread_once2_np), and implement pthread_once in> terms of that.
Pthread is a C interface that has been implemented on many platforms already and I don't see why you think anyone would implement it over std::thread. It 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, if you need to write both.
On the other hand, if a particular platform implements pthread (virtually all do, and we have Windows port of pthread which is a proof of concept at least), implementing the C++ portion of N2178 is a breeze.
Yes.
Pthread is there, standardized, proven in practice, so why not make use of 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 Good Things.
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 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 to write it somehow. Anthony -- Anthony Williams Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL

Emil Dotchevski <emildotchevski@hotmail.com> 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 pthread_once2_np), and implement pthread_once in> terms of that.
Pthread is a C interface that has been implemented on many platforms already and I don't see why you think anyone would implement it over std::thread. It 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, if 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 of 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 Good Things.
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 Thing.
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 to 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? Emil Dotchevski
participants (4)
-
Anthony Williams
-
Emil Dotchevski
-
Peter Dimov
-
Sohail Somani