Synchronization refers to using controls to maintain a coherent representation, either a group of processes running the same program (process synchronization), or representations of data (data synchronization).
1
vote
4answers
106 views
Simple multi-threading class: Does anybody spot potential lock-based concurrency issues?
Trying to write a multi-threaded utility that logs some audit trails to the DB every 30 minutes, or whenever my storage data structure (a list in this case) exceeds a certain limit. The code works ...
3
votes
2answers
63 views
Is this a scenario to use volatile instead of synchronized?
I want to know if using volatile in this scenario will give a better performance than using synchronization. Specifically for the paused and running instance variable in the SimulationManager class.
...
1
vote
1answer
41 views
Timing/Synchronization issues with interrupt-reliant code
I've started to program a state machine on a PIC18F2550 microcontroller. In each state of my machine, there is a designated block of code that runs for a specific amount of real time, such as 20 or 30 ...
1
vote
1answer
237 views
Producer/Consumer with some limitations
The code realizes producer/consumer problem with multiple producers and consumers. Have this code any potential deadlock or races?
//RandomDataProvider.cs
namespace MyNamespace.Core
{
using ...
2
votes
2answers
108 views
Invoking a callback on a pool of threads
This class acts like a synchronization context except the work could be done on any one of the available threads.
I've done quite a bit testing on my own, but I'm generally concerned about potential ...
3
votes
1answer
171 views
Interview example [closed]
Recently I participated in an interview for a Russian company in Moskow and could not answer some of the simple questions. One of them I would like to ask here.
List all problems which you can see in ...
0
votes
1answer
57 views
Synchronization in EJBs
Inspired by Is this synchronized correctly? I want to ask if this code is good.
I have an Java Enterprise application running in Glassfish 2.1 and a Java SE client that communicates with the server ...
6
votes
4answers
359 views
Is this synchronized correctly?
I've never really done anything with concurrency, so I'm not sure if this is done correctly.
Basically I have a Class that handles all messages from the server and decides what to do them. It uses a ...
2
votes
1answer
514 views
Boost Threads - Producer Consumer threads with synchronization - Review
I have below code for multi threaded consumer and single producer. Kindly review it ro concurrency correctness.
#include <iostream>
#include <queue>
#include "boost\thread.hpp"
#include ...
3
votes
4answers
298 views
Java Non Reentrant Lock Implementation
I have implemented a Non Reentrant Lock. I want to know if this has any mistakes, race conditions etc. I am aware of the fact that existing libraries have to be used (instead of writing our own), but ...
5
votes
0answers
75 views
Concurrency limit map in Go
Please someone who knows locks, mutexes, and Go, review the following code.
Task: per host concurrency limits for web crawler (map[string]Semaphore).
I considered chan struct{} (chan bool) approach, ...
3
votes
4answers
168 views
Configurable synchronization approach in Java
I am interested in the community opinion about the following approach for the synchronization.
Generally it is based on the idea to have a configurable way to apply locking on some logic parts.
Any ...
0
votes
1answer
99 views
Usage of Conditions Variables with Pthreads
This is just a program to show the use of condition variable when two threads are involved. One thread wants a non zero value of count, and other thread is responsible for signaling it when the count ...
1
vote
1answer
139 views
How improve a get/set method of a webservice using EclipseLink and database entities?
I am wondering if this is a correct and a good way to write the implementation of two web service methods (get/set method).
The setPerson method can be called from different threads from a pool so I ...
6
votes
0answers
243 views
Very strange race condition which looks like a JRE issue [closed]
I know, I know. It's never a JRE issue. But I've been over this code a lot and I still don't see the issue. It comes from Java Synchronization Not Working as Expected from SO and the poster named ...
1
vote
0answers
436 views
RealTime Collaborative Editor: A CodeMirror extension for MobWrite
I wrote up the following script for the realtime-synchronization service, MobWrite to be used with the browser-based editor, CodeMirror:
// Based on MobWrite's code for TextBoxes
/*Instructions for ...
4
votes
2answers
937 views
thread-safe stl map accessor
So after learning that stl map containers are not inherently atomic and therefore not thread-safe (check out this related stackoverflow question and usage example), I decided to create code that would ...
4
votes
3answers
1k views
Java blocking queue
public class BQueue<T> {
private Queue<T> q = new LinkedList<T>();
private int limit;
public BQueue(int limit) {
this.limit = limit;
}
public ...
2
votes
1answer
240 views
What do you think about resource locker in Qt?
The idea is to lock resource, in c# or java way un Qt with code
lock(obj){/*process with locked obj*/}
No I see, the problem with deleting obj under lock.
resourcelocker.h
#ifndef RESOURCELOCKER_H
...
0
votes
0answers
1k views
Gmail Contacts API Connection Review
I created this class that connects to gMail contacts, and enables you to add/edit/delete the contact.
Curious to see what others think of my code... if you see any areas for improvement, that would ...
3
votes
2answers
509 views
Best practice for synchronization of an ODBC connection?
Since I'm venturing more and more into the Multi-Threaded lands, I now need to think about how to protect my precious OdbcConnection from breaking at random times.
The Project specifications:
...
4
votes
1answer
308 views
Is this waiting code with timeout ok?
public boolean connectedOnGameServer = false;
public final Object conGameServerMonitor = new Object();
public void connectedToGameServer() {
synchronized (conGameServerMonitor) {
...
1
vote
2answers
377 views
Making sure all elements are processed in a JQuery call
I have a piece code similar to below:
But i can help but having a nagging feeling there has to be easier way!
Any ideas?
var synch = false
var indexArray = new Array();
var rowCount = ...
11
votes
3answers
8k views
Correct use of Monitor.Wait, Monitor.Pulse and timeout
I have the following code that I use to determine if connection has been made to a communications device.
I am unsure if my use of Monitor.Wait and Monitor.Pulse is correct. It seems to work alright,
...
