Skip to content

Commit

Permalink
add worker-thread-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
wuxianrong committed Nov 12, 2024
1 parent 08ad77b commit b27f4a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ jobs:
- name: Cleanup
run: |
cp deps/lib/libz.1.dylib .
cp deps/lib/libz.1.dylib tests/integration/
rm -rf ./deps
Expand Down Expand Up @@ -197,9 +198,10 @@ jobs:
- name: Run Go E2E Tests
working-directory: ${{ github.workspace }}
run: |
cd tests/integration/
chmod +x integrate_test.sh
# sh integrate_test.sh
# sh integrate_test.sh

build_pika_image:
name: Build Pika Docker image
Expand Down
6 changes: 3 additions & 3 deletions src/net/src/thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ int ThreadPool::Worker::start() {

int ThreadPool::Worker::stop() {
should_stop_.store(true);
rsignal_.notify_all();
wsignal_.notify_all();
rsignal_.notify_one();
wsignal_.notify_one();
if (start_.load()) {
if (pthread_join(thread_id_, nullptr) != 0) {
return -1;
Expand Down Expand Up @@ -121,7 +121,7 @@ void ThreadPool::Worker::DelaySchedule(uint64_t timeout, TaskFunc func, void* ar
std::unique_lock lock(mu_);
if (!should_stop()) {
time_queue_.emplace(exec_time, func, arg);
rsignal_.notify_all();
rsignal_.notify_one();
}
}

Expand Down

0 comments on commit b27f4a6

Please sign in to comment.