Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add maximum simultaneous tasks support to TaskContainer #464

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change some unique_lock to scoped_lock
  • Loading branch information
cwharris committed Apr 5, 2024
commit e3343a6d847b333279b8b9f93607e0bbd6431621
6 changes: 3 additions & 3 deletions cpp/mrc/src/public/coroutines/task_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
// This will hang the current thread.. but if tasks are not complete thats also pretty bad.
while (not empty())
{
garbage_collect();

Check warning on line 49 in cpp/mrc/src/public/coroutines/task_container.cpp

View check run for this annotation

Codecov / codecov/patch

cpp/mrc/src/public/coroutines/task_container.cpp#L49

Added line #L49 was not covered by tests
}
}

Expand Down Expand Up @@ -77,13 +77,13 @@

auto TaskContainer::garbage_collect() -> std::size_t
{
auto lock = std::unique_lock(m_mutex);
auto lock = std::scoped_lock(m_mutex);
return gc_internal();
}

auto TaskContainer::size() -> std::size_t
{
auto lock = std::unique_lock(m_mutex);
auto lock = std::scoped_lock(m_mutex);
return m_size;
}

Expand All @@ -92,9 +92,9 @@
return size() == 0;
}

auto TaskContainer::capacity() -> std::size_t

Check warning on line 95 in cpp/mrc/src/public/coroutines/task_container.cpp

View check run for this annotation

Codecov / codecov/patch

cpp/mrc/src/public/coroutines/task_container.cpp#L95

Added line #L95 was not covered by tests
{
auto lock = std::unique_lock(m_mutex);
auto lock = std::scoped_lock(m_mutex);

Check warning on line 97 in cpp/mrc/src/public/coroutines/task_container.cpp

View check run for this annotation

Codecov / codecov/patch

cpp/mrc/src/public/coroutines/task_container.cpp#L97

Added line #L97 was not covered by tests
return m_tasks.size();
}

Expand Down
Loading