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

learn more… | top users | synonyms (2)

1
vote
0answers
16 views

Simultaneous works with multithreading

I have a case-study for an Android interview. I just wanted to get your opinion before I share the code with the company. There are two fragments: one of them uses a thread-callback structure and the ...
1
vote
0answers
23 views

Asynchronously load and unload a queue

This code is supposed to asynchronously load a queue from a generating function. ...
1
vote
1answer
38 views

SQL Dependency with Broker

I have written a windows service for one of our local servers. This service works like a gem on my local machine, does what it's supposed to (ACCP to exchange db data), but I'm not overly familiar ...
0
votes
1answer
71 views

const_cast of std::mutex in 'get' member

Look particularly at the const_cast in the member getValue(void). Any comments? It seems the best solution me. ...
4
votes
3answers
417 views

Is it ok to use Thread.Sleep and Thread.Interrupt for pausing and resuming Thread like this?

I need to observe a ConcurrentQueue, but to minimize the resources I want to pause the Thread if the Queue is empty and resume it from another Thread if there is a ...
1
vote
1answer
57 views

Thread lock algorithm

I am trying to make a thread lock for a method so that only one thread can run it at a time. Although this is a well known issue and in C# there is the lock keyword to do it. I was trying to do it on ...
1
vote
0answers
12 views

OSGI bundle and threads

I am new to OSGI. I have 10 threads, writing their names to a file. After recording thread sleep random 0..1 sec, this all must be a bundle. Any comments? ...
1
vote
1answer
24 views

My Own ThreadPool implementation

I tried to make a Server using Java with a Thread Pool. Any review is welcome: ...
7
votes
3answers
101 views

Displaying a wait cursor while we're waiting

I come from VB6 where everything is single threaded, so I've never written a lick of multi-threaded code before. I just added a wait cursor to one of our GUI's by stumbling through the docs, but I'm ...
1
vote
0answers
18 views

Using Java's Fork/Join library from Scala

I am a newbie trying to learn some Java and I am reading prof. Dan Grossman's introductory lecture notes on parallel and concurrent algorithms. I wrote a version of a divide-and-conquer algorithm for ...
1
vote
0answers
18 views

Handling output and exit codes of processes

For a large, multi-threaded video processing application, I need to manage various child processes. I need to monitor their stdout and stderr. My key concerns: I should not have any spin loops. I ...
1
vote
1answer
66 views

Thread Safe Objects in CSharp - ConcurrentDictionary

I'm using ConcurrentDictionary to hold the records.. I'm reading files from the local system in parallel, to speed up the process. Sample 1: ...
2
votes
0answers
31 views

Perform additional tests before waiting for an event

I was looking for a way to perform additional tests before waiting for an event: if everything_is_alright(): event.wait() But this is not thread-safe. A ...
4
votes
1answer
69 views

Show dialog only once. Other calls should bring dialog to front, but otherwise not have a result

This code works, as far as I can tell, but there's something that just feels wrong about it. The intended flow is like this: If no dialog is showing Show dialog, return result else Move dialog ...
3
votes
1answer
46 views

Concurrent LRU cache using sychronizedMap() or ReadWriteLock

Trying to implement a simple, thread-safe LRU cache that's meant for "read mostly" use. Collections.sychronizedMap() Clean, simple, not much else to say. ...
7
votes
1answer
95 views

Code snippet for a method dealing with IDs from multiple threads

I have multiple threads calling a method, passing in an ID and value. I have two constraints I need to place on this method: Only one of the same ID can be processed at a time. Additional threads ...
10
votes
2answers
229 views

Get result from UI thread to non-UI thread when using await Task.Run

I have an application where I use Task to run an operation. During the operation, there can be a problem which will need some user interaction (continue or not). I ...
5
votes
1answer
58 views

TCP Server using NIO to save data from IoT clients

I've built a small single threaded TCP server using NIO. This server is used by small client devices to report things like temperature, when the device has been switched on, when it switches off, and ...
2
votes
3answers
49 views

Thread safety and performance when multiple threads write into same Writer

Multiple threads write data to a file. When maxLines is reached, the file is closed and a new file is created: ...
3
votes
1answer
50 views

File reader and streamer component running in its own thread on Android

In an Android project, I have a class whose job is to read lines from a file, and then pump those lines to a message handling thread, looping forever until told to stop. The main operation of this ...
14
votes
1answer
87 views

Coroutines in C

Please have a look at this little coroutines library ccoro: http://sam.nipl.net/code/ccoro I'd appreciate a general code and style review, and your kind comments! ...
3
votes
2answers
92 views

Simple C++ thread pool

I wrote a minimalistic thread pool using some C++11 features. I've used it on two projects so far and it has worked fine, but when I ran the code on my laptop, I believe that my thread pool might be ...
3
votes
0answers
61 views

Generic GUI background task runner (Java 8+)

Here is the culprit; headers omitted for brevity, and also, see notes afterwards: ...
1
vote
1answer
79 views

Optimizing my program by accessing data locally instead of a remote database

I have a database with 4 tables filled with millions of rows. I have my program run on several computers computing data and then returning it to the database. The huge bottleneck in my program design ...
3
votes
1answer
62 views

Simple concurrent freelist

To become better acquainted with the Intel Parallel Studio XE profilers I'm currently messing around with a simple concurrent freelist. I'm fairly certain that it's thread-safe. It uses Acq/Rel ...
5
votes
1answer
85 views

Beat detection algorithm implementation

What is the quality of the code I've written? Is it easy to read or is it a low-quality piece of code? Also, is there any way I can improve the algorithm itself (beside changing C parameters)? ...
1
vote
0answers
41 views

A Simple Thread Pool in Scala

I wrote the following that spawns n threads, uses them to process a queue of jobs, then returns a result. As well as any general suggestions, I'd like feedback on the following: How safe is ...
3
votes
2answers
67 views

Removing synchronization from an agent for a trading system

Is there any way to easily remove synchronization from this code, when there is a validation step before acquiring a lock? I tried an ...
2
votes
2answers
55 views

Pulling thread data from Invision power board from an external java application

What I am planning on doing is pulling the first post of my news section, this was made for V bulletin and now I need to add it for IPb. ...
3
votes
0answers
44 views

Text-based Snake game on Window - follow-up

Previous question: Text-based Snake game on Window Summary of improvements: Removed unnecessary functions such as clearScreen() Added new ...
3
votes
2answers
80 views

Is this a thread-safe implementation of background bitmap generation?

For a game implementation, I have a very large overview map with multiple layers (namely base-map / units / highlight & info / fov-shading) of which the first is CPU-intensive to generate. I have ...
6
votes
1answer
48 views

Throttling commands

I have a scenario where my BaseRepository gets a lot of commands in a short time period. At other moments, this doesn't happen. What I want to achieve is to throttle these commands. I.e., when a ...
5
votes
3answers
113 views

Counting letters as quickly as possible

I received a task, of taking a known text file (Linux dictionary), use threads to count the different letters in it, and present the results in an array. The code doesn't have to be pretty, elegant, ...
11
votes
1answer
109 views

Storing messages for the application's runtime

I am currently writing a well.. manual testing site for a chat-based bot. The full code can be found on github. For that purpose I had to keep track of the messages currently in the "system". The ...
1
vote
2answers
111 views

Updating list of string while others reading it in Java

I have a logging solution that writes down the hashes of messages. I consider some of these hashes to be safe and I want to skip logging those. I have implemented a whitelist that is a directory ...
3
votes
2answers
503 views

Simple Java Game including Thread

I am a Java beginner and have made a simple Compare Game. It has done well but I am not sure about my solution, especially about my thread. Can you give some advice on making it better? ...
4
votes
1answer
48 views

C++11 class similar to .Net's ManualResetEvent, but without the ability to “reset”

The goal is to block all threads that call WaitOne(). When Set() is called, those threads continue. Any calls to ...
4
votes
0answers
50 views

Simple wrapper class for Win32 console

This is based on a library called Consoledefender V 3.3. I made a minimal class for personal usage based on this library by using C++11. It actually takes user input and prints it back on the console ...
1
vote
1answer
77 views
1
vote
0answers
76 views

FTP client/server sockets

I'm working on a project using socket programming to design an FTP server/client application. This is the code so far. What I need to do is add authentication, I want users to be able to access ...
1
vote
0answers
54 views

Threaded Video Player sync

I am developing a video player with the following design: The main thread - is GUI thread (Qt SDK). Second thread - player thread which accepts commands from the GUI thread to play, forward, ...
7
votes
3answers
825 views

Dining philosophers problem in C++11

Is this implementation correct? Do you find any threading problem? Also, what parts of the code can be changed to be more C++11-ish? ...
3
votes
0answers
104 views

Switching between view controllers that are loaded in the background

I have a dining menu app that scrapes the data from a website and redisplays it in a mobile format, displayed below: If the user swipes left and right, the app will show the previous/next meal (ex. ...
5
votes
1answer
60 views

Implement a blocking counter with a reader/writer lock

I'm trying to implement a blocking counter that may have several readers and writers at the same time: ...
7
votes
1answer
172 views

Lock Using “Interlocked” vs lock Statement (“Monitor”) (Followup)

This is a followup to a previous question. Considering: Interlocked.CompareExchange generates a memory barrier, Intended to be used with very fast operations ...
4
votes
2answers
103 views

Lock Using “Interlocked” vs lock Statement (“Monitor”)

A followup question can be found here, based on this question and it's answer. Considering: Interlocked.CompareExchange generates a memory barrier, Intended to ...
4
votes
0answers
96 views

Deadlock watchdog in a server to defend against poorly written extensions

In the Red5 server we have no control over what implementers do with their applications and as such we have attempted to implement code that would prevent them from causing bad things to happen. ...
3
votes
0answers
55 views

Parallel MSD radix sort in Java

I have this parallel implementation of MSD radix sort, which processes the entries by one particular byte. At each byte index, it has three phases: Count the bucket sizes. Insert each entry to its ...
1
vote
2answers
85 views

Class for multithreaded insert into database

Here I have class that supposed to take dictionaries of product objects and their articles (kind of unique identifier) from queue and insert or update them in database table. Received dictionary ...
4
votes
1answer
76 views

Optimize the Buddhabrot

I am currently working on my own implementation of the Buddhabrot. So far I am using the std::thread-class from C++11 to concurrently work through the following ...