Questions tagged [queue]

A queue is an ordered, first-in-first-out (FIFO) data structure. Typical implementations of queues support pushing elements to the back and popping them off the front position.

37 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
6
votes
0answers
38 views

Concurrent Queue Adapter

There's lots of code out there for basic adapters of std::deque to provide a thread-safe queue. I've adopted that, but wanted to provide a relatively full analog to ...
6
votes
0answers
114 views

Using decorated methods in a subclass of deque to dump its state to a JSON file

I am sub-classing an object in python and I need to overload a bunch of the methods with very similar logic, essentially a call to super() and then some additional operations. I want to avoid ...
5
votes
0answers
52 views

SQS subscriber pattern in background service

I have the below code to pull messages from a FIFO SQS queue. Using the while (IsRunning) loop makes me feel to question the code design. Is there a pattern I am ...
5
votes
0answers
118 views

Yet another multi-producer single consumer queue in C++17

Here's an implementation of a multi-producer single consumer queue that I wanted to use with tasks such as logging from multiple points in a program to a single sink. The implementation is inspired ...
5
votes
0answers
135 views

Concurrent Queue using Ada SPARK with the Ravenscar profile

See here: https://gitlab.com/linted/linted/blob/162b5e9fba53a90b3c6d78e214776e069c3c722b/src/ada-core/src/linted-queues.adb The code implements a concurrent queue. It can't allocate memory or use ...
3
votes
0answers
46 views

Templatized GLib asynchronous queue

I'm working on a legacy C++ project, which is using GLib for its Main Event Loop. This has caused a lot of ugliness because it mixes C++ and C paradigms (no C++ wrapper for GLib had been used). ...
3
votes
0answers
95 views

Lock-free Immutable ConcurrentQueue

Similar to the code review I posted last week for an agent-based immutable replacement for ConcurrentDictionary, I have also created an agent-based immutable ...
3
votes
0answers
658 views

A Thread-Safe FIFO in C99

I started a little weekend project to try and learn how to multithread with pure C99 and POSIX threads. The project is composed of three threads, input, processing, and output, which communicate with ...
3
votes
0answers
343 views

Blocking Promise-driven queues with ECMAScript's async/await and generators

I implemented an AsyncQueue, whose dequeue() operation returns a Promise. The ...
3
votes
0answers
39 views

Python simulacrum of windows copy window

I wrote a program to copy files with an progress bar that looks similar to Windows built in function. The copy function is run in a separate thread and the tkinter GUI is run in the main thread. This ...
3
votes
0answers
2k views

Checking number of messages in jms queue code

I need to check number of messages in a jms queue for that i am using queuebrowser. Actually i have 2 queues. I check if there are more then 10 messages in second queue then the first queue should not ...
3
votes
0answers
439 views

Immutable queue implementation in Scala

I created a queue in which we can perform Enqueue, Dequeue and Traversing in Scala. ...
3
votes
0answers
497 views

Multithreaded queue manager

I've written a simple multithreaded queue manager in JavaScript which will be seeing some pretty heavy usage at a later point in the project I'm working on. I think it's pretty solid, but I wouldn't ...
3
votes
0answers
353 views

Queue with “unlimited” buffer in Go

This is small piece of bigger puzzle, but usable by its own. It an attempt to have a nonblocking queue with "unlimited" (besides memory size) buffer length. Got unit-tests 100% statement coverage, it ...
2
votes
0answers
49 views

Lock-free pooled queue

I am attempting to create a lock free pool of resources and I need the ability to access any one that is not already accessed and then return it back when I do not need it. This will happen very very ...
2
votes
0answers
39 views

File-system based queue in python

I would like to implement a concurrent (multi-thread, multi-process) queue that is backed by file system. Data is pickled over a file, stored in a directory and given a sequential name. The ...
2
votes
0answers
126 views

thread safe queue with interrupt function

I try to implement a thread safe queue with the interrupt function (interrupt all threads who are blocking to take data from queue). ...
2
votes
0answers
108 views

Throttle submissions to ExecutorService

To prevent an XY problem, I'll first explain the problem I am trying to solve: Problem I am trying to solve I want to send the contents of a MongoDB collection with a size of around 3 million ...
2
votes
0answers
432 views

Producer Consumer Using TPL Dataflow

I have written the following class which is supposed to act as a consumer of messages that are passed in from producers and forward them onto amazon SQS, I have made a compromise by starting the ...
2
votes
0answers
240 views

Request Queue for League of Legends API

I am working on some website for League of Legends statistics, which uses the RiotGames API. The API allows you to do a maximum amount of requests per 10 seconds, and another maximum amount of ...
2
votes
0answers
84 views

Blocking Memory Queue

This is a FIFO blocking memory queue in F# to be used as a component in a logging library. ...
2
votes
0answers
1k views

Are there pitfalls to this solution to read messages from a queue in parallel?

I've posted a question on stackoverflow: How can I consequently read messages from a queue in parallel? I would like my own answer to be reviewed. Situation We have one message queue. We would like ...
2
votes
0answers
46 views

Functional, Loaner-Like Pattern For Consuming SQS Queues, Deleting Queue Items On Success

My program fetches input from a RabbitMQ or Amazaon SQS-like queue. There is not always input available in the queue. If a message is available, it triggers work. If that work is successful, ...
2
votes
0answers
514 views

WebApi synchronize database (EF 6) access

I'm working on an ASP.Net MVC 5/WebApi 2 project. I'm using EF 6 code first for my database access. I have a WebApi action method in which I've to update some data in my database based on the request....
1
vote
0answers
25 views

Puzzling SBCL Compiler Note

I’m having trouble understanding an SBCL compiler note about unreachable code in the following function. The referenced code is attempting to push a value into an Lparallel queue: ...
1
vote
0answers
88 views

Immutable Queue with Bulk-Enqueue

I recently needed a data structure with FIFO queue semantics that supported efficient bulk-insertion (often need to enqueue thousands of messages at once). I took a look at Purely Functional Data ...
1
vote
0answers
87 views

thread safe queue with watermarks

A thread-safe queue suspending/resuming the producer when respectively upper/lower watermark has been crossed. Intended usage - interchange between a non-blocking IO loop thread and a consumer running ...
1
vote
0answers
381 views

Continuous queue with delay support

I'm new to programming in Python, and I have a task to try and create continuous queue but with delay support. I need to use this for a messaging queue and simulate network latency at different rates ...
1
vote
0answers
470 views

Socket server with consumer-producer design to handle concurrent connections

The usual way is to implement socket server to handle concurrent requests by creating new thread for each request. Instead of this approach i tried to create a server using ...
1
vote
0answers
683 views

Load balancing consumer and producer with multiprocessing

Tasks are distributed to producer in multiple worker process. Results from workers are sent through Queue to a ...
1
vote
0answers
1k views

Array based Queue Implementation using Templates

This is my first code using templates and I wanted to know if the code looks good? I have some doubts like what's the best way to report error to user (queue full/empty), I checked a link online http:...
1
vote
0answers
77 views

Implementation of Dequeue data structure

I have just started learning to code for interviews and I would like to request a code review of a "Dequeue" data structure. I could not find any implementation anywhere to compare it to. I would like ...
1
vote
0answers
2k views

Deque using doubly linked list

I was trying to implement a deque using a singly LL when I realized that eject() (popping the tail element) wasn't going to work without a pointer to the previous ...
1
vote
0answers
61 views

Counting dropped frames while converting uncompressed video data

I am writing a class for converting uncompressed video data which processes data in its incoming queue and stores them in its outgoing queue. Every time it tries to process a frame of a format it ...
1
vote
0answers
249 views

Queue that permits at most X simultaneous operations

I ran into this once (permits=N) and then again today (permits =1) where I only want 1 to N operations running simultaneously. One example comes from firing into a state machine (the permit=1 example)...
0
votes
0answers
22 views

Priority URL queue that does not block on put()

I am trying to build a priority queue that never blocks on put(), and discards the lowest priority item if it is full and user attempts to ...
0
votes
0answers
611 views

Using RabbitMQ in asp.net web api

Use case : I have a Order web Api which creates an orders and publish the order to messaging queue. Notification service (web api 2) consumes this message by subscribing to the messaging queue and ...