Skip to content

Conversation

@Kellesi
Copy link
Collaborator

@Kellesi Kellesi commented Aug 20, 2025

@Kellesi Kellesi requested a review from Copilot August 20, 2025 17:25

This comment was marked as outdated.

@Kellesi Kellesi force-pushed the KF-33-test-ThreadPool branch from d71797f to a45fd64 Compare August 20, 2025 17:42
@Kellesi Kellesi force-pushed the KF-33-test-ThreadPool branch from a45fd64 to 2a2e108 Compare August 20, 2025 17:45
@Kellesi Kellesi requested a review from Copilot August 20, 2025 17:45
Copy link
Contributor

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

This PR adds comprehensive test coverage for the kf::ThreadPool class to address ticket KF-33. The tests verify core ThreadPool functionality including thread creation, execution, cleanup, and move semantics.

  • Adds test scenarios for normal operation, boundary conditions, and move semantics
  • Includes precompiled header updates with C++ runtime helper functions for kernel-mode testing
  • Fixes uninitialized array issue in ThreadPool header

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
test/ThreadPoolTest.cpp New comprehensive test suite covering ThreadPool functionality with various scenarios
test/pch.h Adds C++ runtime helper functions needed for kernel-mode testing environment
test/CMakeLists.txt Includes the new ThreadPoolTest.cpp in the build configuration
include/kf/ThreadPool.h Initializes m_threads array to prevent undefined behavior

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

KeDelayExecutionThread(KernelMode, FALSE, &interval);
auto p = static_cast<LONG*>(context);
InterlockedIncrement(p);
};
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

The magic number -10'000 should be documented or replaced with a named constant. This appears to be a 1ms delay in 100ns units, but this is not immediately clear.

Suggested change
};
// 1 millisecond delay in 100ns units (negative for relative time)
constexpr LONGLONG ONE_MILLISECOND_DELAY_100NS_UNITS = -10'000;
constexpr auto fn = [](void* context) {
LARGE_INTEGER interval;
interval.QuadPart = ONE_MILLISECOND_DELAY_100NS_UNITS;
KeDelayExecutionThread(KernelMode, FALSE, &interval);
auto p = static_cast<LONG*>(context);
InterlockedIncrement(p);
};

Copilot uses AI. Check for mistakes.

THEN("ThreadPool started up to kMaxCount threads")
{
REQUIRE(value == 64);
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

The magic number 64 should be replaced with a reference to kMaxCount to make the test more maintainable. If kMaxCount changes, this test would fail unexpectedly.

Suggested change
REQUIRE(value == 64);
REQUIRE(value == kf::ThreadPool::kMaxCount);

Copilot uses AI. Check for mistakes.
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