Comments (4)
show me your code。
破坏断言十有八九是你用错了。
from muduo.
void done(Condition* cond)
{
char ch;
std::cin >> ch;
cond->notify();
}
int main()
{
MutexLock mutex;
Condition cond(mutex);
Thread thread(boost::bind(done, &cond));
thread.start();
cond.wait();
std::cout << "done" << std::endl;
return 0;
}
from muduo.
条件变量的 wait() 必须在 Mutex 加锁的情况下调用,muduo 代码中的断言正是为了捕捉你的这个错误。
from muduo.
明白了,我把条件条件变量当作Event使用了,谢谢!
from muduo.
Related Issues (20)
- 请问一下:exception caught in Thread reason: call to empty boost::function Aborted (core dumped) HOT 2
- muduo::net::Buffer中有unread方法吗 HOT 3
- muduo Buffer类单独测试爆undefined HOT 2
- addTimer 为什么是线程安全的,通过什么写法实现的? HOT 1
- error: ‘setTimeZone’ is not a member of ‘muduo::Logger’
- stackTrace HOT 2
- 是否支持http 1.1 管线化 HOT 1
- bug: Timer callbacks may still be invoked even after the timer has been canceled HOT 1
- base/test/logging_test.cc编译后运行遇到了段错误 HOT 1
- difference between muduo and glog?
- About TimerQueue's CancelInLoop
- 性能测试,chargen,netty,ttcp等测试带宽大概897Mbps为什么比iperf3的 941 Mbits/sec要小一些 HOT 2
- connection是否应该进行线程保护? HOT 1
- 想了好几天,想的没睡着觉。callingPendingFunctors_会不会延迟回调?
- 安装问题:protobuf3.x版本 HOT 1
- unique_ptr使用问题
- problem
- 定时器失效问题
- 编译base/TimeZone.cc与base/tests/TimeZone_util.cc时报错,添加-Wno-conversion与-Wno-missing-field-initializers后编译成功 HOT 1
- surport vcpkg?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from muduo.