Giter Site home page Giter Site logo

seanpburke / nifty Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 8.0 417 KB

ANSI C pthread packages for thread pools, queues/channels, task timers, set operations, red-black btree associative map.

License: MIT License

C 99.15% Makefile 0.85%
c concurrency pthread-packages pthreads

nifty's People

Contributors

mikedoug avatar seanpburke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

nifty's Issues

Resource leak in nft_queue if queue is not empty at nft_shutdown time

I'm not sure if this is still being maintained, but I have some code that was using an older version of nft_queue and wanted to try upgrading to this version since you've now built in the reference counting (thank you!).

However, after converting to this new version, I have determined with 100% certainty that there is a resource leak if this condition happens:

  1. You call nft_queue_shutdown(q, 0) when there is an item waiting in the queue.
  2. You then immediately call nft_queue_pop_wait(q,0) on the queue until it is drained (returns NULL). I believe this is what the documentation says you need to do in order to get the queue to shut down.

I see exactly why this is happening -- in the nft_queue_shutdown(...) code you release the original creation reference count if and only if the queue is empty. What you don't do upon popping items from the queue and the queue becoming empty to see if it is in shutdown and also releasing the extra count.

I have a fix for this which I'll push up to github momentarily and open a pull request.

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.