Namespaces
Variants
Views
Actions

std::execution::transfer

From cppreference.com
< cpp‎ | execution
 
 
 
Defined in header <execution>
execution::sender auto transfer( execution::sender auto input,
                                 execution::scheduler auto scheduler );
(since C++26)

[edit] Parameters

input - sender to be transferred on the scheduler
scheduler - scheduler on which the sender will run

[edit] Return value

Returns a sender describing the transition from the execution agent of the input sender to the execution agent of the target scheduler.

[edit] Example

Possible usage of execution::transfer.

execution::scheduler auto cpu_sched = get_system_thread_pool().scheduler();
execution::scheduler auto gpu_sched = cuda::scheduler();
 
execution::sender auto cpu_task = execution::schedule(cpu_sched);
// cpu_task describes the creation of a new task on the system thread pool
 
execution::sender auto gpu_task = execution::transfer(cpu_task, gpu_sched);
// gpu_task describes the transition of the task graph described by cpu_task to the GPU