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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [multithreading]

Multi-threading is how work performed by a computer can be divided into multiple concurrent streams of execution (generally referred to as threads).

1
vote
0answers
38 views

Simple Asynchronous Dispatch Queue

I'm practicing C++11/14/17 and am teaching myself the STL multithreading library by writing an asynchronous dispatch queue for my simple use case. It seems to "work ok" but I want to know if it's ...
1
vote
0answers
30 views

Java local service with sockets

My goal was to create a Java service on Windows that runs locally and communicates with local programs using JSON. The service should be reliable and robust. The service runs a ServerSocket and ...
2
votes
0answers
31 views

Comparing Java Semaphore versus ReentrantReadWriteLock

In this post, I attempted to compare the performance of two concurrency constructs: java.util.concurrent.Semaphore, ...
0
votes
0answers
24 views

Clarification on running multiple async tasks in parallel with throttling and polly policies [closed]

I'm trying to run multiple async Tasks in parallel with throttling using polly AsyncBulkheadPolicy + WaitAndRetryPolicy. My understanding so far is that the policy method ExecuteAsync does not itself ...
2
votes
0answers
64 views

C++ Producer / Consumer multi threads pattern with maximum container size

I've just written a Producer / Consumer pattern templatized that should work in multi threads environment (IE producer(s) and consumer(s) in separate threads). The original use case is one producer ...
6
votes
2answers
204 views

C++ parallel merge sort

I'm a first year computer engineering student who's learning about algorithms and data structures. I've implemented a parallel merge sort algorithm in C++ and would like constructive criticism. This ...
1
vote
0answers
19 views

Initializing and managing many references in multithreaded control application

I have a large multi-window GUI program (implemented with MFC) that controls a variety of physics experiment apparatus. When the user starts the main function of the program (the "experiment" run), a ...
2
votes
0answers
61 views

Many-readers-one-writer with semaphores and multithreading

I've been looking for a solution to the may readers one writer in Java. I was intrigued by this question posted here and I read the Wikipedia entry about it. So far, I've reached a fine solution, or ...
4
votes
0answers
73 views

A Parallel Processing Template for Divide & Conquer Problems

I’ve written a program for solving a problem using standard single-threaded code. However, it looks like it could be recast as a multi-threaded problem using divide & conquer. Since this is a ...
2
votes
2answers
77 views

C++ thread_pool with heterogeneous work-queue

I have read the book "C++ concurrency in action" and understood the thread_pool implementation. I have changed a few things according to my project requirements. I have used ...
2
votes
1answer
42 views

Multithreaded local server

I'm writing several local servers which have almost the same code in main.cpp. Appreciate your comments, improvement suggestions and especially notes on potential ...
2
votes
0answers
158 views

Let Them Eat Lists, Eventually (Asynchronous Generic List Consumption with Spring and CompletableFuture)

I want to reduce some repeated code in my Java 1.8/Spring Boot application, and to that end I tried to make a reuseable asynchronous utility module. In essence its an async List.forEach that takes a ...
1
vote
1answer
52 views

Multithreading to allow multiple clients on to a server and client requests handling

I have to create a client-server JavaFX application using MVC which does many operations consisting mainly in messages exchange. I'd like to know if this way to handle client acceptance and client ...
2
votes
0answers
26 views

C++ observer pattern via boost.signals2

I was looking for a thread safe implementation of the observer pattern. I read https://xinhuang.github.io/posts/2015-02-11-how-a-multi-threaded-implementation-of-the-observer-pattern-can-fail.html and ...
0
votes
0answers
51 views

Is this the proper way to inform the main thread of an event from a Background thread?

The background-thread is an UDP listener. As soon as a certain type of message is received, the main thread has some work to do. My current solution works. But I'm in doubt of the implementation. My ...
3
votes
1answer
74 views

Golang HTTP requests

I'm beginning to learn about Golang and I would like to have some advice about the following program. ...
6
votes
1answer
140 views

C++ Pi Calculator - Leibniz Formula

Yesterday I saw a CodeTrain video in where Daniel Shiffman tried to approximate Pi using the Leibniz series. It was interesting so I decided to try it too. I wrote this console application with a ...
1
vote
1answer
84 views

Java concurrency exercise, implementing transfer of amount from one account to another

This is in continuation with my synchronized implementation of a bank account in Java. I am trying to implement bank accounts repository and method to transfer money from one account to another. My ...
7
votes
2answers
785 views

Synchronized implementation of a bank account in Java

I am trying to implement a bank account with Java in a thread safe way. My code looks like: ...
2
votes
0answers
111 views

Sending device data of 10k items with Parallel.ForEach

I have a deviceList of more than 10k items and want to send data by calling another method. I tried to use Parallel.Foreach but I'm not sure is this the correct ...
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 ...
3
votes
2answers
76 views

java Thread-safe LRUCache implementation

What is best way to implement thread-safe LRUCache in java? Please review this one. Is there any better approach which can be taken here? ...
0
votes
0answers
29 views

threaded event loop “interrupt” unit test without deadlocks

I have an event_loop implementation (basically an event/command queue and an exec function). I have added ...
0
votes
1answer
40 views

Stopping a running thread

I am trying to stop an executing runnable instance after the run method has been called. I have come up with the below approach ...
5
votes
1answer
65 views

Implementation of thread-safe vector

I have implemented a thread safe vector, based on std::thread and std::vector. I am new to many of the patterns used in threading and was wondering if there's a more efficient way the locking can be ...
1
vote
0answers
27 views

Socket sending/receiving data

I am a beginner in Android and this is my first big project in it. I am trying to communicate with an STM Discovery board using an ESP01 module. Below is the client connection class ...
0
votes
0answers
26 views

Mutex implementation using Windows APC

I just wrote this now and didn't test it much. This isn't a replacement for std::mutex, but for something like fun. I may develop it to make it shared across processes by storing the counters in a ...
1
vote
0answers
48 views

An attempt of replacing CRITICAL_SECTION with std::mutex and std::lock_guard

I have an older class that I am working on and I'm updating it to remove "Windows" specific code. It had some "Thread Protection Code" that used CRITICAL_SECTION. I'...
0
votes
0answers
25 views

Create a simple job system using a mutex-locked task queue

Although an experienced gameplay programmer, I'm relatively new to multithreading. I've attempted an implementation of a job system that my WIP 2D engine uses: it provides "engine" and "game" workers, ...
7
votes
2answers
173 views

Multi-threaded Conway's Game of Life in C++

Here is my implementation of Conway's Game of Life in C++ which takes advantage of multi-threading. I'm using SFML 2.5.1 for a graphics library and CMake. I also use SFML's ...
1
vote
2answers
54 views

Mutex Protected Object (scoped object wrapper)

This is a class that holds mutex and associated object. On checkout/access the mutex is locked while the stack object lives and a reference to object is obtained. Any suggestions or improvements is ...
-1
votes
1answer
60 views

MQTT Client that send, receive and process mqtt messages

I'm setting up a python mqtt client that is supposed to receive messages of specific topics, process the messages when all incoming messages from the clients are complete, output the new calculated ...
3
votes
1answer
121 views

Sanity check for Simple Threading library

I've created a library providing a ThreadBlock that has the following features: Aggregates results of all actions executed Provides for non-threaded warm up to ...
5
votes
2answers
102 views

Using two threads to increase RFC1951 Deflate compression performance

I have modified my implementation of RFC 1951 "Deflate" compression to use two threads. One thread performs the LZ77 matching, looking for sequences of at least three bytes that occur earlier in the ...
1
vote
1answer
93 views

Receiving and sending notifications from database

I'm not much familiar with Task Api programming in C#. Can anyone review my following code? The following is a ElapsedEventHandler of a ...
2
votes
1answer
47 views

Sharing data with another thread using lock_guard

I wrote a updater_thread() and a reader_thread(), and used lock_guard to protect a global ...
1
vote
0answers
42 views

Applying Observer-Observable pattern to a code and multithreading

I have to: 1) Apply the Observer-Observable pattern to the original code. 2) starting from the original code, I have to suppose that the modification of the array fields (slot machine numbers) ...
0
votes
0answers
37 views

Inter Thread communication between n thread

The following program takes 3 integer inputs(noOfThreadToBeCreate,fromNo,toNo) and print the Consecutive numbers based on the range using different threads e.g (Thread 1 - Print 1, Thread 2 - print 2, ...
-1
votes
1answer
71 views

Waking up a thread while sleeping [closed]

I have a thread which periodically executes a task. Something like the following: ...
2
votes
0answers
39 views

Thread-safe sensor interface with observer and strategy patterns

I have a thread-safe API for an observable Sensor. The concrete type of the Sensor is chosen in the ...
1
vote
1answer
52 views

Processing a company list in which every element is an employee list

Now, there is a company list in which an element is an employee list in every company. I calculate the salary of employees in every company with a RESTful API one by one,. This is very slow, so I join ...
1
vote
0answers
66 views

Image capture client - multi-threading + sharing data between services

I'm working on a small side project at the moment - like a homemade CCTV system. This part is my Python Capture Client - it uses OpenCV to capture frames from a connected webcam and sends the frames ...
2
votes
0answers
63 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
0answers
23 views

A syslog to Azure Log Analytics forwarder

I am using this code to forward my syslog logs (converted to json using syslog-ng) to Azure Log Analytics on an ARM board (since there is no official client for ARM)...
0
votes
1answer
124 views

Generating parallel random numbers in a thread-safe way and using them in computations implemented by class method [closed]

I have the following code that I managed to make thread-safe but I am not sure if I am using C++ technology optimally. ...
2
votes
1answer
60 views

Java League of Legends ping checker

I'm still a freshman and this one of my first projects I made using Java and Swing. The program is a simple League of Legends multi-threaded ping checker that pings the server 10 times to get an ...
4
votes
1answer
448 views

Concurrent observable collection

I'm working on a WPF 4.5 desktop application that has several nested collections with the following key aspects: writes mainly from UI thread, but also from worker threads writes are relatively ...
2
votes
1answer
60 views

Simple multithreading C project

I'm fairly new to C, and this is my first time using pthread. I am pretty sure I implemented it correctly, however I'd like to verify it is indeed executing the ...
3
votes
0answers
59 views

Using Python threads to download images

I am using Python threads to download images. I have a JSON file that contains URLs to the images in the following structure: ...
3
votes
2answers
45 views

Python 3 multi-threaded pinger

My goal: I want to ping every single IPv4 address and record whether or not they responded. The way I have it set up is every IP address corresponds to an index. For example ...