Questions tagged [multithreading]
Use this tag when the program performs its work using multiple concurrent threads of execution.
1,628 questions
8
votes
3
answers
124
views
Test to ensure CGI can be invoked on a local server
I am writing tests for legacy software which has a dependency on CGI scripts on a remote machine.
Mocking the dependency would entail modifying the code under test, which is a thing I cannot do at the ...
6
votes
1
answer
350
views
Implementing a mutex-free thread safe scheme for protecting a object
I've written a MQTT client for embedded system with RTOS (understand not POSIX, generally FreeRTOS). There's no pthread in the system. There's only 32 bits atomic instructions supported.
The client ...
0
votes
0
answers
53
views
ReadWrite Lock compatible with coroutines
A while ago I wrote for my own needs a (non-reentrant) read-write lock for kotlin's coroutines. I got no reactions on the relevant github thread. I think it's a nice code, so I thought I'd share it ...
2
votes
0
answers
182
views
Namespace-scope try_lock_for / try_lock_until pt. 2
This is my second iteration of implementing try_lock_for/try_lock_until function templates in which I've cherry-picked a bunch ...
4
votes
3
answers
707
views
Multithreaded array summation in Java - best practice, structure, acceptable use of Constant classes. There is no concurrency?
The task is educational. The basic functionality is working. Here are some questions for my code. Please give me feedback.
Main:
Architecture & Design: Is the decomposition appropriate? Should ...
7
votes
3
answers
1k
views
Rotary Encoder Controller C++
I built a controller with 3 rotary encoders to control various parameters of a program i wrote to control a motor. The controller delivers data via usb through serial (Arduino).
Originally I used OSC ...
8
votes
2
answers
1k
views
C# wait for a state change without blocking
I have a class that manages an HttpClient to make API requests to a third party service. The service requires being logged in to make requests. When logged in, a ...
0
votes
2
answers
132
views
Small library for metrics scraping in C++
I did an internship test project (source: https://github.com/SynI20N/VKInfo). Looking for some middle or senior devs to rate it and point out potential problems with my code.
Follow up: How would you ...
4
votes
1
answer
115
views
Simple async lock using key in .NET
The task is to make a simple LockProvider that will lock a thread by identifier.
Basic requirements:
Simple call via using block.
Support for CancelationToken to get out of waiting without exceptions....
3
votes
2
answers
132
views
Simple WinAPI Event manager implementation
Trying to learn windows internals and made my first work with Events and Threads. What do you think about my code? Any advice?
...
3
votes
1
answer
145
views
Wait for results/failure of an unreliable async operation
Abstract Problem
The basic problem is that of producer/consumer. Wait for an async Producer to [produce an item] or [fail], together with a timeout on the consumer side.
Using Java's ...
7
votes
1
answer
756
views
Shortest unrestricted path to touch every square in an n by n grid
The goal is to brute force the length of the shortest unrestricted path that touches any part of each square within an n by n square grid.
Unrestricted path meaning any continuous curve between two ...
4
votes
1
answer
104
views
A class that will manage a thread and execute tasks (e.g., SQL queries) within it
I am interested in creating a class that manages a thread and executes SQL queries sequentially within it. The queries would be submitted from various parts of the program, and the results would be ...
10
votes
2
answers
1k
views
Multithreaded UDP server that advertises itself in a PostgreSQL database and launches other servers in response to messages from a client
Description
For fun, and to learn some C++, I've decided to reimplement the entirety of EVE online as I remember it. (I'm aware this is an insane and likely unreachable goal, that's intentional).
I'...
4
votes
3
answers
203
views
Threads in Java with ExecutorService
I'm experimenting with Threads in Java and came upon the ExecutorService class.
I've written the following code:
...
3
votes
1
answer
126
views
Multi-Page Web Scraping Code Using Selenium with Multithreading
I have written a web scraping script using Selenium to crawl blog content from multiple URLs. The script processes URLs in batches of 1000 and uses multithreading with the ThreadPoolExecutor to ...
2
votes
1
answer
100
views
Multithreaded Merge Sort Using ForkJoin Framework
I've implemented a multithreaded merge sort using Java's ForkJoin framework, and I wanted to gather feedback on its correctness, efficiency, and scalability.
Here's my implementation:
...
2
votes
1
answer
70
views
Synchronizing an embedded system with RTOS
I wrote this code for a make-up assignment to pass one of my college class and graduate from my program in the field of electronic and embedded system.
It's pretty much the realization of a solar ...
5
votes
2
answers
693
views
Thread-safe write-efficient register() method for a Load balancer
The code below was written for an interview question of designing a load balancer with only a register() method.
...
3
votes
1
answer
169
views
Amount Transfer Between Different Accounts - Improved Version
This is an improved code version for Amount Transfer Between Different Accounts
Welcoming any further improvements for this.
...
5
votes
2
answers
958
views
Reduce String Length With Thread Safety & Concurrency
I implemented the below URL Shortener class. Used ConcurrentHashMap to handle concurrency.
Short URL building logic may not be optimal, but it ensures that only ...
3
votes
1
answer
82
views
Not so Simple Thread Pool (part 2)
Previous version of my ThreadPool is here
This one is improved and updated using advices:
added variables list (vector) to not use std::any. it's very basic and simple.
added thread-safe queue
!main....
9
votes
1
answer
248
views
Movie Barcode Generator
Task
I wrote a movie barcode generator in C++ using OpenCV. Self-described engineer, space lover and tea drinker Thomas Poulet defines a movie barcode as follows:
A Movie Barcode is the color ...
8
votes
2
answers
1k
views
A TCP server which uses one thread to read while writing data with another thread
The TCP server in the code snippet below is designed to:
Read data using one thread while writing data with another thread.
Allow only one client to be connected at a time.
Automatically close the ...
2
votes
1
answer
117
views
Take photographs using simulated cameras that share a lock
I'm new to threading in Python. I want to use it to speed up taking images on my lab computer. I have the following dummy code:
...