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

static initialization order fiasco when init log object in static field #30

Closed
pippocao opened this issue Nov 4, 2024 · 0 comments · Fixed by #31
Closed

static initialization order fiasco when init log object in static field #30

pippocao opened this issue Nov 4, 2024 · 0 comments · Fixed by #31
Assignees

Comments

@pippocao
Copy link
Collaborator

pippocao commented Nov 4, 2024

memory_map_handle memory_map::create_memory_map(const bq::file_handle& map_file, const size_t offset, const size_t size)
{
memory_map_handle result;
if (!map_file.is_valid()) {
result.error_code_ = EBADF;
bq::util::log_device_console_plain_text(log_level::error, "create_memory_map with invalid map_file");
return result;
}
auto fd = map_file.platform_handle();
auto current_size = lseek(fd, 0, SEEK_END);
// alignment
size_t alignment_offset = offset % __memory_map_size_unit;
......
}

__memory_map_size_unit is defined as global static variable, which leads to static initialization order fiasco

@pippocao pippocao linked a pull request Nov 4, 2024 that will close this issue
@pippocao pippocao pinned this issue Nov 4, 2024
@pippocao pippocao closed this as completed Nov 4, 2024
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 a pull request may close this issue.

2 participants