Skip to content

Fix GCC build: add missing unistd.h for usleep()#3

Open
Hughpig wants to merge 2 commits intobbuhrow:mainfrom
Hughpig:patch-1
Open

Fix GCC build: add missing unistd.h for usleep()#3
Hughpig wants to merge 2 commits intobbuhrow:mainfrom
Hughpig:patch-1

Conversation

@Hughpig
Copy link

@Hughpig Hughpig commented Mar 1, 2026

usleep() requires <unistd.h> on POSIX systems.

Fixes implicit declaration error with GCC 11+.

Copilot AI review requested due to automatic review settings March 1, 2026 03:00
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes GCC 11+ implicit declaration errors for usleep() by adding the appropriate POSIX header include in the threadpool implementation.

Changes:

  • Add <unistd.h> include to provide the usleep() declaration on POSIX/GCC.
  • Minor whitespace-only diff noise (license block reflow in diff + trailing blank line).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 25 to 29
#include <stdint.h>
#include <stdio.h>
#include "threadpool.h"
#include <unistd.h>

Copy link

Copilot AI Mar 1, 2026

Choose a reason for hiding this comment

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

#include <unistd.h> is currently unconditional, which can break Windows/MSVC builds since <unistd.h> is POSIX-only. Please guard this include (e.g., under the existing #if defined(WIN32) || defined(_WIN64) / #else split) or move it into the non-Windows branch near the usleep() usage.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Restored the MIT License header and included necessary headers for thread pool implementation.
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