Skip to content

Commit 13d0448

Browse files
authored
Upgrade libcoro dependency (#570)
The semaphore fixes we need are now in main. Another change is that the thread pool is now managed as a unique_ptr to avoid reference cycles. Authors: - Lawrence Mitchell (https://github.com/wence-) Approvers: - Mads R. B. Kristensen (https://github.com/madsbk) URL: #570
1 parent 7cdb747 commit 13d0448

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

cmake/thirdparty/get_libcoro.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ function(find_and_configure_libcoro)
1414
GLOBAL_TARGETS libcoro
1515
BUILD_EXPORT_SET rapidsmpf-exports
1616
CPM_ARGS
17-
GIT_REPOSITORY https://github.com/wence-/libcoro
18-
# We need a version that includes https://github.com/jbaldwin/libcoro/pull/371,
19-
# https://github.com/jbaldwin/libcoro/pull/384, https://github.com/jbaldwin/libcoro/pull/389,
20-
# and https://github.com/jbaldwin/libcoro/pull/399
21-
GIT_TAG 4a1f369b2f9c9131b842813fd1b50520a6af3a36
17+
GIT_REPOSITORY https://github.com/jbaldwin/libcoro
18+
# We need a version that includes all PRs up to https://github.com/jbaldwin/libcoro/pull/399 and
19+
# https://github.com/jbaldwin/libcoro/pull/400
20+
GIT_TAG 7e0ce982405fb26b6ca8af97f40a8eaa2b78c4fa
2221
GIT_SHALLOW FALSE
2322
OPTIONS "LIBCORO_FEATURE_NETWORKING OFF"
2423
"LIBCORO_EXTERNAL_DEPENDENCIES OFF"

cpp/include/rapidsmpf/streaming/core/channel.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ class Channel {
172172
* @param executor The thread pool used to process remaining messages.
173173
* @return A coroutine representing the completion of the shutdown drain.
174174
*/
175-
Node drain(std::shared_ptr<coro::thread_pool> executor) {
176-
return rb_.shutdown_drain(std::move(executor));
175+
Node drain(std::unique_ptr<coro::thread_pool>& executor) {
176+
return rb_.shutdown_drain(executor);
177177
}
178178

179179
/**

cpp/include/rapidsmpf/streaming/core/context.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class Context {
3030
* @param options Configuration options.
3131
* @param comm Shared pointer to a communicator.
3232
* @param progress_thread Shared pointer to a progress thread.
33-
* @param executor Shared pointer to a coroutine thread pool.
33+
* @param executor Unique pointer to a coroutine thread pool.
3434
* @param br Shared pointer to a buffer resource.
3535
* @param statistics Shared pointer to a statistics collector.
3636
*/
3737
Context(
3838
config::Options options,
3939
std::shared_ptr<Communicator> comm,
4040
std::shared_ptr<ProgressThread> progress_thread,
41-
std::shared_ptr<coro::thread_pool> executor,
41+
std::unique_ptr<coro::thread_pool> executor,
4242
BufferResource* br,
4343
std::shared_ptr<Statistics> statistics
4444
);
@@ -84,9 +84,9 @@ class Context {
8484
/**
8585
* @brief Returns the coroutine thread pool.
8686
*
87-
* @return Shared pointer to the thread pool.
87+
* @return Reference to unique pointer to the thread pool.
8888
*/
89-
std::shared_ptr<coro::thread_pool> executor();
89+
std::unique_ptr<coro::thread_pool>& executor();
9090

9191
/**
9292
* @brief Returns the buffer resource.
@@ -106,7 +106,7 @@ class Context {
106106
config::Options options_;
107107
std::shared_ptr<Communicator> comm_;
108108
std::shared_ptr<ProgressThread> progress_thread_;
109-
std::shared_ptr<coro::thread_pool> executor_;
109+
std::unique_ptr<coro::thread_pool> executor_;
110110
BufferResource* br_;
111111
std::shared_ptr<Statistics> statistics_;
112112
};

cpp/src/streaming/core/context.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Context::Context(
1414
config::Options options,
1515
std::shared_ptr<Communicator> comm,
1616
std::shared_ptr<ProgressThread> progress_thread,
17-
std::shared_ptr<coro::thread_pool> executor,
17+
std::unique_ptr<coro::thread_pool> executor,
1818
BufferResource* br,
1919
std::shared_ptr<Statistics> statistics
2020
)
@@ -41,7 +41,7 @@ Context::Context(
4141
options,
4242
comm,
4343
std::make_shared<ProgressThread>(comm->logger(), statistics),
44-
coro::thread_pool::make_shared(
44+
coro::thread_pool::make_unique(
4545
coro::thread_pool::options{
4646
.thread_count = options.get<std::uint32_t>(
4747
"num_streaming_threads",
@@ -75,7 +75,7 @@ std::shared_ptr<ProgressThread> Context::progress_thread() {
7575
return progress_thread_;
7676
}
7777

78-
std::shared_ptr<coro::thread_pool> Context::executor() {
78+
std::unique_ptr<coro::thread_pool>& Context::executor() {
7979
return executor_;
8080
}
8181

0 commit comments

Comments
 (0)