3232#include < utility>
3333
3434namespace STDEXEC {
35+ #if !STDEXEC_NO_STD_COROUTINES()
3536 namespace __task {
3637 // //////////////////////////////////////////////////////////////////////////////
3738 // A base class for task::promise_type so it can be specialized when _Ty is void:
@@ -66,7 +67,7 @@ namespace STDEXEC {
6667 return (__total_size / __chunk_size) + (__total_size % __chunk_size != 0 );
6768 }
6869
69- struct alignas (__STDCPP_DEFAULT_NEW_ALIGNMENT__) __block {
70+ struct alignas (__STDCPP_DEFAULT_NEW_ALIGNMENT__) __memblock {
7071 std::byte __storage_[__STDCPP_DEFAULT_NEW_ALIGNMENT__];
7172 };
7273
@@ -77,10 +78,10 @@ namespace STDEXEC {
7778 template <class _PAlloc >
7879 struct __any_alloc final : __any_alloc_base {
7980 using value_type = std::allocator_traits<_PAlloc>::value_type;
80- static_assert (__same_as<value_type, __block >);
81- // Number of __block -sized chunks we needed store the allocator:
81+ static_assert (__same_as<value_type, __memblock >);
82+ // Number of __memblock -sized chunks we needed store the allocator:
8283 static constexpr size_t __alloc_blocks =
83- __task::__divmod (sizeof (__any_alloc), sizeof (__block ));
84+ __task::__divmod (sizeof (__any_alloc), sizeof (__memblock ));
8485
8586 explicit __any_alloc (_PAlloc __alloc)
8687 : __alloc_(std::move(__alloc)) {
@@ -91,8 +92,8 @@ namespace STDEXEC {
9192 // overallocated to store the allocator in the blocks immediately following the
9293 // promise object. We now use that allocator to deallocate the entire block of
9394 // memory:
94- size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__block ));
95- void * const __alloc_loc = static_cast <__block *>(__ptr) + __promise_blocks;
95+ size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__memblock ));
96+ void * const __alloc_loc = static_cast <__memblock *>(__ptr) + __promise_blocks;
9697
9798 // Quick sanity check to make sure the allocator is where we expect it to be.
9899 STDEXEC_ASSERT (__alloc_loc == static_cast <void *>(this ));
@@ -104,7 +105,7 @@ namespace STDEXEC {
104105 std::destroy_at (this );
105106 // Deallocate the entire block of memory:
106107 std::allocator_traits<_PAlloc>::deallocate (
107- __alloc, static_cast <__block *>(__ptr), __promise_blocks + __alloc_blocks);
108+ __alloc, static_cast <__memblock *>(__ptr), __promise_blocks + __alloc_blocks);
108109 }
109110
110111 _PAlloc __alloc_;
@@ -263,7 +264,7 @@ namespace STDEXEC {
263264 // If the receiver's stop token is different from the task's stop token, then we need
264265 // to set up a callback to request a stop on the task's stop source when the receiver's
265266 // stop token is triggered:
266- __callback ().__construct (
267+ __stop_callback ().__construct (
267268 get_stop_token (get_env (__rcvr_)),
268269 __on_stopped_t {__coro_.promise ().__stop_ .template get <0 >()});
269270 }
@@ -299,7 +300,7 @@ namespace STDEXEC {
299300 }
300301 }
301302
302- auto __callback () noexcept -> __manual_lifetime<__stop_callback_t <_Rcvr>>&
303+ auto __stop_callback () noexcept -> __manual_lifetime<__stop_callback_t <_Rcvr>>&
303304 requires __needs_stop_callback<_Rcvr>
304305 {
305306 return *this ;
@@ -309,7 +310,7 @@ namespace STDEXEC {
309310 if constexpr (__needs_stop_callback<_Rcvr>) {
310311 // If we set up a stop callback on the receiver's stop token, then we need to
311312 // disable it when the operation completes:
312- __callback ().__destroy ();
313+ __stop_callback ().__destroy ();
313314 }
314315
315316 std::printf (" opstate completed, &__errors_ = %p\n " , static_cast <void *>(&this ->__errors_ ));
@@ -338,7 +339,7 @@ namespace STDEXEC {
338339
339340 void __canceled () noexcept final {
340341 if constexpr (__needs_stop_callback<_Rcvr>) {
341- __callback ().__destroy ();
342+ __stop_callback ().__destroy ();
342343 }
343344
344345 std::exchange (__coro_, {}).destroy ();
@@ -422,14 +423,14 @@ namespace STDEXEC {
422423
423424 template <class _Alloc , class ... _Args>
424425 void * operator new (size_t __bytes, std::allocator_arg_t , _Alloc __alloc, _Args&&...) {
425- using __palloc_t = std::allocator_traits<_Alloc>::template rebind_alloc<__task::__block >;
426+ using __palloc_t = std::allocator_traits<_Alloc>::template rebind_alloc<__task::__memblock >;
426427 using __pointer_t = std::allocator_traits<__palloc_t >::pointer;
427428 static_assert (std::is_pointer_v<__pointer_t >, " Allocator pointer type must be a raw pointer" );
428429
429430 // the number of blocks needed to store an object of type __palloc_t:
430431 static constexpr size_t __alloc_blocks =
431- __task::__divmod (sizeof (__task::__any_alloc<__palloc_t >), sizeof (__task::__block ));
432- size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__task::__block ));
432+ __task::__divmod (sizeof (__task::__any_alloc<__palloc_t >), sizeof (__task::__memblock ));
433+ size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__task::__memblock ));
433434
434435 __palloc_t __palloc (__alloc);
435436 __pointer_t const __ptr =
@@ -447,8 +448,8 @@ namespace STDEXEC {
447448 }
448449
449450 void operator delete (void * __ptr, size_t __bytes) noexcept {
450- size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__task::__block ));
451- void * const __alloc_loc = static_cast <__task::__block *>(__ptr) + __promise_blocks;
451+ size_t const __promise_blocks = __task::__divmod (__bytes, sizeof (__task::__memblock ));
452+ void * const __alloc_loc = static_cast <__task::__memblock *>(__ptr) + __promise_blocks;
452453 auto * __alloc = static_cast <__task::__any_alloc_base*>(__alloc_loc);
453454 __alloc->__deallocate (__ptr, __bytes);
454455 }
@@ -497,4 +498,5 @@ namespace STDEXEC {
497498 __variant_for<stop_source_type, stop_token_type> __stop_{};
498499 __opstate_base* __state_ = nullptr ;
499500 };
501+ #endif // !STDEXEC_NO_STD_COROUTINES()
500502} // namespace STDEXEC
0 commit comments