Skip to content

Commit

Permalink
Merge pull request #2752 from SGSSGene/fix/bgzf_thread_count_variable
Browse files Browse the repository at this point in the history
[FIX] make a bgzf_thread_count a single variable
  • Loading branch information
smehringer committed Jan 18, 2022
2 parents 0f5fb9d + 1ec1bba commit f668060
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ If possible, provide tooling that performs the changes, e.g. a shell-script.
#### I/O
* Changed default of `output_options::fasta_blank_before_id` to `false`
([\#2769](https://github.com/seqan/seqan3/pull/2769)).
* Changed default of `bgzf_thread_count` to `4` instead of determining the numbers of cores of the
machine it is running on ([\#2911](https://github.com/seqan/seqan3/pull/2911)).
* `bgzf_thread_count` is now a single global variable instead of having an instance per translation unit
([\#2752](https://github.com/seqan/seqan3/pull/2752)).

# 3.1.0

Expand Down
9 changes: 7 additions & 2 deletions doc/cookbook/compression_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
//![example]
#include <seqan3/io/all.hpp>


// The `bgzf_thread_count` is a variable that can only be changed during run time of the program.
// This does not work, the value must be overwritten within a function.
// seqan3::contrib::bgzf_thread_count = 1u;
// seqan3::contrib::bgzf_thread_count = 1u; // Doesn't work

int main()
{
// Use one thread for (de-)compression.
// Here we change the number of threads to `1`. This is a global
// change and will effect the every future bgzf decompression call
// which doesn't specify an explicit thread count parameter.
// Already running decompression calls are unaffected by this
seqan3::contrib::bgzf_thread_count = 1u;

// Read/Write compressed files.
Expand Down
2 changes: 1 addition & 1 deletion include/seqan3/contrib/stream/bgzf_stream_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace seqan3::contrib

/*!\brief A static variable indicating the number of threads to use for the bgzf-streams. Defaults to 4.
*/
[[maybe_unused]] inline static uint64_t bgzf_thread_count = 4;
[[maybe_unused]] inline uint64_t bgzf_thread_count = 4;

// ============================================================================
// Forwards
Expand Down

1 comment on commit f668060

@vercel
Copy link

@vercel vercel bot commented on f668060 Jan 18, 2022

Choose a reason for hiding this comment

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

Please sign in to comment.