Open Jamaika1 opened 4 years ago
In short, [jthread
|https://en.cppreference.com/w/cpp/thread/jthread] is fairly similar to thread
due to being built on top of it (the linked jthread repository uses an underlying stop_source
and ::std::thread
). Because it builds on the standard thread
and provides the other requisite classes, it ought to be compatible with mingw.thread. Note, however, that the linked repository uses features not available in C++11 and C++14, which indicates that it would need to be re-implemented if jthread
were to be added to this repository.
In short: Mingw.thread should be sufficient for jthread
, as linked, but the linked jthread
is not suitable (in its current state) for the mingw.thread repository.
Thanks for info I compiled the following josuttis/jthread with mingw for c++17 for openexr. I don't know. Does it make sense? Is it legal since if jthread is patented for c++20? I am interested in this issue for the new JPEG codecs in c ++ 17. For c++11 and c++14 I needed new features from c++17. There is no point in looking for std::is_same_v and std::is_nothrow_constructible_v replacements here. For c ++ 20 I also compiled but without jthread.h because the editor already has this library. https://github.com/AcademySoftwareFoundation/openexr/commit/59608240ed175a17f0fec9fc7e9682a6a6d75754
Summarizing. Is jthread and thread the same only for other languages?
@Jamaika1 Generally speaking, check the license. In the case of the repository you linked, the license for that particular implementation is listed in the readme: "The code is licensed under a Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/)."
That said, this is no longer relevant to the mingw-std-threads repository. If you are interested in asking questions about licensing, it is likely that you can find answers in another location, such as Stack Overflow.
Generally. Then why all this jthread ad? For gcc, the function < thread > has jthread inside and in c++20 it doesn't need jthread.hpp. Is there something more here than in compilers? Do you know any jthread libraries for c++11/14/17? Is there a stupid question in itself?
Generally speaking, the goal would be to have a complete implementation of the C++ standard library. This applies to the libraries shipped with compilers (GCC, Clang, Visual Studio, etc.). It also applies to this repository, because this repository is intended to provide the thread implementation that is missing in MinGW and MinGW-w64.
As of C++20, that list of libraries includes jthread.
That said, the library you linked is the closest that I currently know of to a jthread library for earlier versions of C++. According to its license, it can be forked (copied) and adapted to work with C++11 and C++14, provided that the original author is credited and any changes are noted.
How different is the std::thread from std::jthread? Does it make sense to change definitions for c++20? Is std::jthread only under c++20? I was able to compile std::jthread under c++17. Is it compatible with mingw.thread? https://github.com/josuttis/jthread