Skip to content

Commit

Permalink
Initialize all struct fields
Browse files Browse the repository at this point in the history
Avoid uninitialized members.
  • Loading branch information
bad code committed Sep 22, 2024
1 parent 89cb932 commit 36b438b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,7 @@ void clean_quit(int sig) {
pthread_cancel(Runner::runner_id);
}
#else
struct timespec ts;
ts.tv_sec = 5;
constexpr struct timespec ts { .tv_sec = 5, .tv_nsec = 0 };
if (pthread_timedjoin_np(Runner::runner_id, nullptr, &ts) != 0) {
Logger::warning("Failed to join _runner thread on exit!");
pthread_cancel(Runner::runner_id);
Expand Down

0 comments on commit 36b438b

Please sign in to comment.