Code Monkey home page Code Monkey logo

Comments (7)

olk avatar olk commented on August 29, 2024

I'm wondering, buffered_channel doesn't have a try_value_pop() member function.

from fiber.

tschuett avatar tschuett commented on August 29, 2024

My bad. I called try_pop (https://github.com/boostorg/fiber/blob/master/include/boost/fiber/buffered_channel.hpp#L374) which calls try_pop_ (https://github.com/boostorg/fiber/blob/master/include/boost/fiber/buffered_channel.hpp#L120) which calls try_value_pop_(https://github.com/boostorg/fiber/blob/master/include/boost/fiber/buffered_channel.hpp#L99). Here I ran in the endless loop.

from fiber.

olk avatar olk commented on August 29, 2024

could you provide test-code that demonstrates your problem

from fiber.

tschuett avatar tschuett commented on August 29, 2024

Here is the reproducer. The last output I get is:
ct2_inner calling tryp_pop
try_pop_: full=0 empty=0 capacity=1 closed=0 producers=0 consumers=0 consumer_idx_=0 slots_[0].cycle.load()=2
The try_pop call never returns.

reproducer.zip

from fiber.

olk avatar olk commented on August 29, 2024

buffered_channel's capacity must be a power of two - I've changed the test in the constructor

from fiber.

jondo2010 avatar jondo2010 commented on August 29, 2024

I have a use case for a capacity of 1, is it possible to relax this power-of-2 requirement?

from fiber.

olk avatar olk commented on August 29, 2024

Unfortunately no - buffered_channel requires a capacity of power of two because positions inside the buffer are calculated via shift operations (for performance reasons).

What is your use case for a capacity of two? Maybe unbuffered_channel is a option?

from fiber.

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.