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

Fix test timeout redux #161

Merged
merged 15 commits into from
Nov 20, 2023
Merged

Conversation

aliddell
Copy link
Member

@aliddell aliddell commented Nov 17, 2023

  • Fixes a bug in the Zarr V3 writer where external metadata was tacitly assumed to be nonempty.
  • Removes explicit thread start from ThreadPool in favor of start on construction.
  • Aborts thread jobs in the destructor only, allowing any job that's made it on to the queue to finish before shutting down the thread pool in the usual case.

@aliddell aliddell changed the title Merged too soon Fix test timeout redux Nov 17, 2023
Copy link

@andy-sweet andy-sweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now.

But please update the PR description to match the changes!

src/common.hh Outdated
std::vector<std::thread> threads_;
mutable std::mutex jobs_mutex_;
std::condition_variable cv_;
std::queue<JobT> jobs_;

bool started_;
std::atomic<bool> should_stop_;
std::atomic<bool> is_accepting_jobs_;

/// Multithreading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional

This comment is not very informative. I think it's telling me that these methods are expected be executed on the worker threads this pool owns (and not on the client/calling thread). The other useful information is that the caller of these methods is expected to lock the require mutex to guarantee thread safety and consistency. So maybe update this along those lines?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll just remove the comment.

@@ -60,24 +60,22 @@ struct ThreadPool final
ThreadPool(size_t n_threads, std::function<void(const std::string&)> err);
~ThreadPool() noexcept;

void start();
void push_to_job_queue(JobT&& job);
void await_stop() noexcept;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional

Add a comment here to explain that calling this will wait/block until pending jobs are complete. Also, after this is complete, no new jobs can be submitted.

Copy link

@andy-sweet andy-sweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -5,7 +5,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## [0.1.5](https://github.com/acquire-project/acquire-driver-zarr/compare/v0.1.3...v0.1.4) - 2023-11-20

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume you're planning to tag the commit associated with merging this PR with v0.1.5? If so, looks good.

@aliddell aliddell merged commit 7d814dc into acquire-project:main Nov 20, 2023
4 checks passed
@aliddell aliddell deleted the fix-test-timeout branch November 20, 2023 18:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants