Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

5
votes
0answers
42 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 ...
3
votes
0answers
35 views

msmq bulk send in c# [on hold]

Please review the code below and provide constructive feedback to improve. Multiple threads call the SendMessageToMSMQ method to send messages to a msmq queue. ...
12
votes
3answers
10k views

STL queue implementation

I've implemented a simple C++ STL like queue. (I've tried to follow @LokiAstari stack implementation code fashion) ...
6
votes
0answers
29 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 ...
5
votes
0answers
93 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 ...
-4
votes
1answer
54 views

Generic Custom STACK Class for Hanoi Problem in C# [closed]

I have created a custom class (Generic) in C# for the Hanoi problem. and I am not sure I did the correct thing. ...
2
votes
0answers
30 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 ...
1
vote
1answer
38 views
3
votes
1answer
28 views

Singly-linked queue in PHP 7

I am learning PHP 7 and decided to implement a simple FIFO singly-linked queue in it: ...
28
votes
4answers
4k views

FIFO data structure in pure C

I programmed a generic queue in pure C and I'd love to receive some feedback from other programmers. You may use the following questions to guide your review. Is the API well thought and idiomatic? ...
7
votes
2answers
180 views

Cyclic queue using an array

I tried to implement a cyclic Queue using an array, as a task from a coding interview. Please comment about style, as well as any edge cases I may have missed. ...
8
votes
1answer
55 views

JSON messaging queue with transformation and dispatch rules

I put together this code as part of a practice problem. The instructions for the program are to accept JSON messages, transform the messages and then dispatch them to the right queue according to a ...
1
vote
0answers
24 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: ...
6
votes
1answer
142 views

Implementing a queue: questions and clarification

Im trying to teach myself some computer science (and c++). I am relatively new to this (and to code review). I have attempted to implement a queue. I have copied the code below for reference. ...
2
votes
1answer
67 views

Simple raw buffer queue implementation

I am trying to implement a simple raw queue in C++. This is what I have come up with ...
2
votes
1answer
43 views

Queue Interview Code basic methods made from struct Node optimized

Using feedback from my previous implementation I'm writing a very simple Queue of struct Nodes with only these methods get_front(), get_back(), pop_front(), push_back(), and a ostream friend method. I ...
2
votes
3answers
101 views

Queue Interview Code basic methods made from struct Node

Thanks for all the feedback, I optimized the code here. Here I'm Writing a very simple Queue of struct Nodes with only these methods get_front(), ...
0
votes
0answers
429 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 ...
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 ...
1
vote
1answer
72 views

Action to transmit queued messages over a socket

I have this action and it works but looks rather clunky to me. Is there any way I could improve that? ...
4
votes
1answer
104 views

Basic queue implementation in C

I'm practicing data structures in C and I implemented a queue based on its description: ...
3
votes
2answers
144 views

Circular Queue in C for an embedded project

I wrote a simple circular queue. (in order to store characters because of the fact, that I am using UART through the DMA and sometimes my printf's override each other) I am looking for some review, ...
5
votes
2answers
337 views

A simple queue implementation in Haskell

I'm a member of a discord channel and sometimes people post simple coding exercises for fun. This time the exercise was: Implement the following operations of a queue using stacks. push(x) -- Push ...
2
votes
0answers
103 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). ...
1
vote
1answer
63 views

Queue implementation in ES6 [closed]

Here's my Queue implementation in ES6, ...
0
votes
1answer
120 views

Array-based Queue

Description: An array-based Queue class. Since this class is designed using an array the size of the Queue is limited to whatever the program gives you. MAX_SIZE ...
15
votes
2answers
634 views

Interprocess Communication in a Farmer-Worker setup

The following code is my first C program I have made for an university assignment about Interprocess Communication. This involved creating a parent process, the farmer, and then creating a certain ...
7
votes
1answer
106 views

Custom implementation of python queue to use dict instead of dqueue

A bit of context: I have 100 addresses that can send transactions to a blockchain, and I have a web app that works like this: Get request and handle it in a thread Get a free address from the queue ...
1
vote
1answer
177 views

Rust Task Queue

The purpose of this program is to have one thread (main thread) working on I/O reading lines from a file and feeding it to a pool of worker threads whose job is to perform some processing on each line ...
4
votes
1answer
139 views

Node.JS Server Queue Processor

I implemented a simple queuing system for my Node.JS app and wanted a critique on it's structure. ...
2
votes
2answers
54 views

Simple array operation using a Queue

Question We are given an array (indexed from 1) of N elements on which we make M queries: add(Left, Right, X) - all the elements between the position Left and Right (1<=Left<=Right<=N) are ...
1
vote
2answers
774 views

Single producer single consumer command queue

I needed to create commands simply with lambda and execute it in another thread. The following code works fine. Any suggestions about performance are appreciated. I want to use SSE aligned variables ...
4
votes
4answers
113 views

A queue implemented using an array

We've just finished learning about queues in my data structures class; I want to make sure I really understand it. I'm still feeling a bit lost on how to optimize the data use of a queue. I've ...
5
votes
1answer
279 views

Single producer single consumer wait-free object container

I have a fast producer thread and a slow consumer thread. The consumer processes as many objects as it can and simply ignores the rest in order to not slow down the producer. Therefore, I used a one-...
4
votes
1answer
222 views

Implementing a queue using a linked-list

In my intro CS class we're reviewing data structures. I'm currently working on implementing a queue using a linked list (FIFO) in C. I'd appreciate a review of the implementation as well as of my ...
0
votes
1answer
62 views

C++ container to manage waiting/sent messages

In my project I send messages, so there are items that should be sent and that were already sent. I want to have container to manage these two entities. The container I wrote seems to work ok. It ...
1
vote
1answer
111 views

DynamicList/LinkedList Queue Implementation

here is my LinkedList Queue Implementation , seems like its almost like the linkedlist implementation with little differences mainly in the poll() method, i think that the offer() method is same like ...
3
votes
1answer
490 views

Non-recursive BFS Maze Solving with Python

I wrote this program to help me understand how BFS and Queues work. (Also DFS if I replace the queue with a stack). It works, but I'm curious how well I implemented the algorithm. Are there any ...
3
votes
0answers
42 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). ...
2
votes
1answer
51 views

A queue, used to print four strings

I made a queue that prints out strings a, b, c, and d. It works, but I want to make sure I don't have any unnecessary code. I realized that my main method prints the strings without the queue. Is ...
-1
votes
1answer
357 views

Thread-safe queue mechanism

Is it my queue mechanism thread safe? I just wonder if I need concurrent collections. Need I lock Enqueue method? Console displays queue count in incorrect order, Does it affect on maxQueueCount at ...
1
vote
1answer
162 views

Queue implementation using unique_ptr

I am trying out different data structures to learn more about smart pointers. I have created a queue implementation which has push, ...
2
votes
2answers
5k views

Priority Queue Linked List Implementation

I am new to Python and wanted to make sure my code answers the question for my assignment due. My Task: A priority queue is a queue in which each item is assigned a priority and items with a ...
3
votes
2answers
92 views

C++ workqueue class

This is a nice workqueue class template to keep the gui fluid, while data is being written into a database or into some file/network... ...
9
votes
1answer
663 views

A thread-safe priority queue keeping its elements unique

This class is intended to be used in situations where queue.Queue does not suffice, because the following two properties are needed. Every item in the queue can ...
4
votes
1answer
231 views

A thread safe task queue implementation using my own lock_guard in C++

As an exercise in multithreaded programming, I am trying to implement a basic FIFO task queue. For this, I also implement simplified version of my lock_guard, from ...
6
votes
0answers
101 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 ...
6
votes
1answer
236 views

Updatable priority queue

This is an updatable priority queue. In contains an index (implemented as std::unordered_map) which maps a value to its position in the queue itself. The queue is ...
4
votes
1answer
206 views

Packet process time simulation using queue

Here is my code for the below packet time simulation problem using queue. My code works correctly but it's slow, please help with suggestions to improve run time and other suggestions for performance ...
5
votes
2answers
516 views

Implementation of deque

What can be simplified, altered, or implemented differently? I would like to know if there's a way to further improve this code. ...