MCPcopy Create free account
hub / github.com/NVIDIA/stdexec / handle_multi_blur_request

Function handle_multi_blur_request

examples/server_theme/split_bulk.cpp:160–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160auto handle_multi_blur_request(http_request const & req) -> ex::sender auto
161{
162 return
163 // extract the input images from the request
164 ex::just(req)
165 | ex::then(extract_images)
166 // process images in parallel with bulk.
167 // use let_value to access the image count before calling bulk.
168 | ex::let_value(
169 [](std::vector<image> imgs)
170 {
171 // get the image count
172 size_t img_count = imgs.size();
173 // return a sender that bulk-processes the image in parallel
174 return ex::just(std::move(imgs))
175 | ex::bulk(ex::par,
176 img_count,
177 [](size_t i, std::vector<image>& imgs) { imgs[i] = apply_blur(imgs[i]); });
178 })
179 // transform the resulting 3 images into an HTTP response
180 | ex::then(imgvec_to_response)
181 // done; error and cancellation handling is performed outside
182 ;
183}
184
185auto main() -> int
186{

Callers 1

mainFunction · 0.85

Calls 3

thenFunction · 0.85
apply_blurFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected