Skip to content

Commit

Permalink
Merge pull request markparticle#22 from markparticle/dev_mark
Browse files Browse the repository at this point in the history
🐛 avoid shock
  • Loading branch information
markparticle committed Jul 4, 2020
2 parents 0377228 + 65585a7 commit 1e580bf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions code/http/httpresponse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const unordered_map<string, string> HttpResponse::SUFFIX_TYPE = {
{ ".gz", "application/x-gzip" },
{ ".tar", "application/x-tar" },
{ ".css", "text/css "},
{ ".js", "text/javascript "},
};

const unordered_map<int, string> HttpResponse::CODE_STATUS = {
Expand Down
10 changes: 5 additions & 5 deletions code/log/blockqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void BlockDeque<T>::Close() {

template<class T>
void BlockDeque<T>::flush() {
condConsumer_.notify_all();
condConsumer_.notify_one();
};

template<class T>
Expand Down Expand Up @@ -123,7 +123,7 @@ void BlockDeque<T>::push_back(const T &item) {
condProducer_.wait(locker);
}
deq_.push_back(item);
condConsumer_.notify_all();
condConsumer_.notify_one();
}

template<class T>
Expand All @@ -133,7 +133,7 @@ void BlockDeque<T>::push_front(const T &item) {
condProducer_.wait(locker);
}
deq_.push_front(item);
condConsumer_.notify_all();
condConsumer_.notify_one();
}

template<class T>
Expand All @@ -159,7 +159,7 @@ bool BlockDeque<T>::pop(T &item) {
}
item = deq_.front();
deq_.pop_front();
condProducer_.notify_all();
condProducer_.notify_one();
return true;
}

Expand All @@ -177,7 +177,7 @@ bool BlockDeque<T>::pop(T &item, int timeout) {
}
item = deq_.front();
deq_.pop_front();
condProducer_.notify_all();
condProducer_.notify_one();
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion code/pool/threadpool.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class ThreadPool {
std::lock_guard<std::mutex> locker(pool_->mtx);
pool_->tasks.emplace(std::forward<F>(task));
}
pool_->cond.notify_all();
pool_->cond.notify_one();
}

private:
Expand Down
Binary file added readme.assest/压力测试.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1e580bf

Please sign in to comment.