Skip to content

Commit 646a685

Browse files
committed
[FIX] make a bgzf_thread_count a single variable
bgzf_thread_count was declared `inline static` outside of the scope of a class. In this case the `inline` allows the variable to break the one definition rule. Meaning there can be multiple symbols across different translation that all declare `bgzf_thread_count`. In this case the linker will choose one of the defined symbols. (Without inline it would throw a multiple definition error). The `static` keyword (in this context) means that the created symbol is only visible inside a current translation unit. Meaning, there are no symbols for the linker to work with. This will cause every translation unit to have there own `bgzf_thread_count` variable. This combination leads to every translation unit having there own `bgzf_thread_count` variable, which is not what a user of seqan3 expects. The fix is simple, we remove the `static` keyword. This should have the intended behavior. Thought: maybe it should be declared `thread_local`.
1 parent b3588d1 commit 646a685

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

include/seqan3/contrib/stream/bgzf_stream_util.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ namespace seqan3::contrib
3838
/*!\brief A static variable indicating the number of threads to use for the bgzf-streams.
3939
* Defaults to std::thread::hardware_concurrency.
4040
*/
41-
inline static uint64_t bgzf_thread_count = std::thread::hardware_concurrency();
41+
inline uint64_t bgzf_thread_count = std::thread::hardware_concurrency();
4242

4343
// ============================================================================
4444
// Forwards

0 commit comments

Comments
 (0)