Closed nmcclatchey closed 6 years ago
Hi team I used your mingw-std-threads-6bd14b1ba5946b18de2f2239fca2b108152cd503.zip attachment. I know that there are still tests. Unfortunately, I have a problem with libheif.
mingw.future.h: In instantiation of 'static void
_mingw_stdthread::detail::StorageHelper
_mingw.future.h:947:19: required from 'static void mingw_stdthread::detail::StorageHelper
_mingw.future.h:1066:24: required from 'std::future<typename std::__invoke_result<typename std::decay<_Tp>::type, typename std::decay<_Args>::type ...>::type> std::async(std::launch, _Fn&&, _Args&& ...) [with _Fn = heif::Error (heif::HeifContext::)(unsigned int, std::shared_ptr
_heifcontext.cc:1185:77: required from here
_mingw.future.h:938:52: error: must use '.' or '->' to call pointer-to-member function in 'std::forward<heif::Error (heif::HeifContext::&)(unsigned int, std::shared_ptr
938 | state_ptr->set_value(std::forward
Good catch. I'll replace the function call with invoke
.
That particular problem should be fixed. If you find any others, please let me know ASAP.
Thanks
Implements core features of the C++11
<future>
header. Specifically, this pull request adds support forfuture
shared_future
promise
async
Some work yet remains before the library can be considered final. Specifically,
packaged_task
is not yet implemented.std::function
and apromise
, or the classes internal tomingw.future.h
can be employed.promise<T>::set_value_at_thread_exit
currently uses a second "helper thread" that detects when the original thread exits. This is, of course, inefficient, but I do not yet know another way to ensure that the value is set only after allthread_local
objects are destroyed. This approach should be replaced later, if doing so is possible.Though unrelated, the pull request also changes certain protected members of
thread
to be private and replaces a standard-violating macro. Names with an underscore followed by a capital letter are reserved by the standard; the macro's purpose can be accomplished safely by using a static constexpr variable at class scope instead.