yyzybb537 / libgo

Go-style concurrency in C++11
MIT License
3.18k stars 754 forks source link

mutex destroyed while busy问题找到了 #293

Open bizehao opened 1 year ago

bizehao commented 1 year ago

用手机写得,格式不好弄,不好意思

windows 的mutex destroyed while busy问题找到了,我觉得这不只是windows的问题,

在libgo\routinesync\rutex.h 227行左右这块,你定义了一个局部变量 RutexWaiter rw(*switcher); 在252行,你 进行了waiters.push(&rw);,相当于把局部变量的指针放进了容器了,出这个函数,这个局部变量就析构了。我把  RutexWaiter rw(*switcher);改成堆变量 new的形式,就正常了,测试后没有出现 mutex destroyed while busy