Skip to content

Commit 65585a7

Browse files
committed
🐛 avoid shock
1 parent bce86ed commit 65585a7

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

code/http/httpresponse.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const unordered_map<string, string> HttpResponse::SUFFIX_TYPE = {
2626
{ ".gz", "application/x-gzip" },
2727
{ ".tar", "application/x-tar" },
2828
{ ".css", "text/css "},
29+
{ ".js", "text/javascript "},
2930
};
3031

3132
const unordered_map<int, string> HttpResponse::CODE_STATUS = {

code/log/blockqueue.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void BlockDeque<T>::Close() {
8383

8484
template<class T>
8585
void BlockDeque<T>::flush() {
86-
condConsumer_.notify_all();
86+
condConsumer_.notify_one();
8787
};
8888

8989
template<class T>
@@ -123,7 +123,7 @@ void BlockDeque<T>::push_back(const T &item) {
123123
condProducer_.wait(locker);
124124
}
125125
deq_.push_back(item);
126-
condConsumer_.notify_all();
126+
condConsumer_.notify_one();
127127
}
128128

129129
template<class T>
@@ -133,7 +133,7 @@ void BlockDeque<T>::push_front(const T &item) {
133133
condProducer_.wait(locker);
134134
}
135135
deq_.push_front(item);
136-
condConsumer_.notify_all();
136+
condConsumer_.notify_one();
137137
}
138138

139139
template<class T>
@@ -159,7 +159,7 @@ bool BlockDeque<T>::pop(T &item) {
159159
}
160160
item = deq_.front();
161161
deq_.pop_front();
162-
condProducer_.notify_all();
162+
condProducer_.notify_one();
163163
return true;
164164
}
165165

@@ -177,7 +177,7 @@ bool BlockDeque<T>::pop(T &item, int timeout) {
177177
}
178178
item = deq_.front();
179179
deq_.pop_front();
180-
condProducer_.notify_all();
180+
condProducer_.notify_one();
181181
return true;
182182
}
183183

code/pool/threadpool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class ThreadPool {
5454
std::lock_guard<std::mutex> locker(pool_->mtx);
5555
pool_->tasks.emplace(std::forward<F>(task));
5656
}
57-
pool_->cond.notify_all();
57+
pool_->cond.notify_one();
5858
}
5959

6060
private:

readme.assest/压力测试.png

37.8 KB
Loading

0 commit comments

Comments
 (0)