Code Monkey home page Code Monkey logo

threadpool's Introduction

threadPool

一个基于C++ 14 17 开发【可变参模板实现的线程池】

Function directory:

  • map和queue容器【线程管理和任务调度】
  • condition_variable和互斥锁mutex实现任务提交线程|任务执行线程间的通信机制
  • fixed固定线程池数量和cached动态线程数量的线程池定制
  • 可变参模板编程+引用折叠,实现线程池submitTask接口,支持任意任务函数和任意参数 的传递
  • 用future和packaged_task模式定制submitTask异步提交任务的返回值

项目问题:

  • 线程的资源回收,等待线程池里面所有线程退出时,却发生死锁问题,导致主进程无法退出!!!
  • 在windows平台下运行良好的线程池,在linux平台下运行发生死锁问题,平台运行结果不一致!!!

解决方案:

linux下通过gdb attach到正在运行的进程,通过info threads,thread tid,bt等命令查看各个子线程的调用 堆栈信息,一行一行定位项目代码,最终定位到发生死锁的代码位置,分析死锁问题发生的原因,最终解决

threadpool's People

Contributors

jiqinwj avatar

Watchers

 avatar

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.