Giter VIP home page Giter VIP logo

Comments (3)

xia-chu avatar xia-chu commented on May 21, 2024

打个补丁就行了,这个是RingBuffer对象实现修改过了 之前的老test程序不完全匹配。
这个bug的是因为EventPoller对象会在自己线程中删除自己,相当thread对象绑定的线程中删除thread对象本身,
原因由于RingReader对象会保持EventPoller对象的强引用,在其析构时,会发个任务给EventPoller,如果此时main函数推出了,
那么只有EventPoller线程会保持它自己的引用,从而在他自己的线程中释放自己。

Index: tests/test_ringBuffer.cpp
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- tests/test_ringBuffer.cpp	(revision 7ae5f547c17ddc7bee7b82ebc114248df99de620)
+++ tests/test_ringBuffer.cpp	(date 1609754428000)
@@ -85,6 +85,7 @@
 
     //释放环形缓冲,此时触发Detach事件
     g_ringBuf.reset();
+    ringReader.reset();
     sleep(1);
     return 0;
 }

from zltoolkit.

rmokerone avatar rmokerone commented on May 21, 2024

修改后程序不异常退出了,但是Detach事件也不会触发了。

from zltoolkit.

xia-chu avatar xia-chu commented on May 21, 2024

嗯 现在detach和onread事件都是异步了 所以这样。 ringReader.reset();放在 sleep(1);后面吧。
这个代码现在不怎么通用了 完全是给zlmediakit特化定制的了

from zltoolkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.