Synchronization refers to using controls to maintain a coherent representation, such as processes running the same program (process synchronization).

learn more… | top users | synonyms

0
votes
2answers
79 views

Java synchronization task

I have the following task: Implement a simple command line Java application for booking bus seats. For simplicity suppose there is only one bus, initially all seats (lets say 50) are free. ...
1
vote
0answers
18 views

Passive FTP port assignment synchronization

I've created the following class to manage the assignment of port numbers to passive FTP server sockets. Notice that Semaphore here is to make the thread wait in ...
3
votes
1answer
34 views

Synchronization of new data with previous data

I am working with synchronization for the first time. I wrote some code that I have to implement in my current work. I wanted to know if I am doing it right or am I making a mistake. Whenever a new ...
1
vote
3answers
233 views

Implementing an asynchronous mutex in C#

I wrote a simple synchronization primitive that I can use with async operations on an external REST service so that I don't call it twice from different threads and have one call fail due to not ...
1
vote
0answers
82 views

Dining philosophers using channels

I have the following code to solve dinning philosophers problem using Go channels and am looking for review comments: ...
3
votes
1answer
54 views

Synchronization algorithm for deterministic context switching between threads

Curious how sqlite3 would handle different race conditions in a multithreaded environment, I created a simple module called deterministic for serializing the ...
2
votes
1answer
80 views

Multithreading, shared queue as synchronization point

I have two threads, one produces images and one processes them. For the synchronization, I created a class where you can set and get images, and it always waits until an image is available or a worker ...
1
vote
0answers
134 views

Synchronize access to an instance method using a static serial queue

In my current project I have a number of data services classes, each one dedicated to a specific source of data so that it's responsible of downloading data from its API, checking for local database ...
5
votes
1answer
556 views

Boost condition variable wrapper

I would like to create a wrapper for a Boost conditional variable: ...
4
votes
1answer
154 views

ConcurrentHashMap Implementation

I have written a simplified version of my own MyConcurrentHashMap. I tried to make use of a Lock[] array for ...
0
votes
1answer
322 views

Synchronizing two SQL Server database tables with the most recent changes to both tables

I'm very new to SQL, but I'm coding a C# program that interacts with a database. There's a master database on my computer, and there's a client database on my tablet. When I re-connect my tablet to ...
3
votes
1answer
151 views

Simple read/write lock without using a critical section

I have implemented a simple read/write lock without using a critical section. I have tested my code by running 50 threads reading and writing the same data. .h file ...
2
votes
0answers
58 views

Porting Java semaphore to MacOSX

I wanted to write some more JNI code and decided to (re)implement a semaphore for MacOSX. In order to assert somehow correctness of my implementation I hereby supply a (multi)consumer/(multi)producer ...
5
votes
2answers
553 views

Synchronization in an event manager

I'm working on an event manager, and I am wanting it to be a tool developers use. It is lightweight and it uses annotations to register events. I've tried to set up ...
3
votes
2answers
83 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 ...
3
votes
1answer
189 views

Blocking builder with singleton

I am trying to implement a singleton builder that would be shared across multiple builder threads for Coordinate objects. Here is the simplified target class ...
5
votes
1answer
384 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 ...
5
votes
1answer
54 views

Synchronization Event with awaitAny

In Java, there is no way I know of to wait for multiple events at the same time (see Stack Overflow). Since I would like to use that feature (similar to ...
3
votes
1answer
361 views

Thread synchronization and happens-before relation in simple examples

I wrote those examples to show different approaches to sharing results between threads. The whole code is on GitHub. All examples should return "Hello world". Are these OK from the perspective of ...
6
votes
1answer
4k views

Timer UI-updating implementation for educational purposes

I thought it would be helpful to put together an example of what I'm talking about in the second part of my answer to this Stack Overflow question. The idea is that there's some data that is updated ...
5
votes
2answers
2k views

Accessing a String value from multiple threads without synchronization

I'm looking for some input here. I have a class that contains a value which is updated every few seconds by a method within that class. Right now, access to this value across multiple threads is ...
7
votes
1answer
1k views

Portable C++ boost::interprocess::mutex

I was looking for long time around to have a portable robust solution for multiprocessing synchronization. Who touche this things know that good solution are boost::iterprocess named sync objects. ...
10
votes
2answers
3k views

Using synchronized blocks and volatile variables to ask a Java thread to terminate gracefully

Edit: Just to clarify, this isn't my original code, I've simplified it to make it smaller/easier to understand what I'm trying to do. It's my first time working with threads in Java, and I was ...
3
votes
1answer
142 views

Spurious wakeups in Java's BlockingQueue.take()

I wrote this code where I trap InterruptedException's in a blocking queue and try again to consume from the same queue thinking of spurious wakeups. I don't know if ...
2
votes
2answers
526 views

Reusing objects using a generic object pool

After reading a lot of documents, I wrote this object pooling code. Can anyone help me to improve this code? I am lagging in validating the object, confirming whether I can reuse it or not. ...
5
votes
2answers
17k views

Simple thread pool in C++

I wrote a simple thread pool, which works pretty well. I would like to see your review of it. One important feature that I needed in the pool is the ability to wait until all the tasks that I sent to ...
1
vote
2answers
1k views

Windows Phone 8 web service app classes

I have a classes for working with a web service (Windows Phone 8 app). My main question is about the thread-safety of the solutions. I think there will be problems with a static class ...
2
votes
0answers
341 views

Simple multithreading and synchronization problems in MFC

I use a worker thread for some data processing in my MFC project. In the thread-controlling function, it needs to use some parameters (declared as member variables) to the data-processing. I use a sub-...
1
vote
4answers
707 views

Multi-threaded utility that logs some audit trails

I'm 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 ...
3
votes
2answers
200 views

Using volatile instead of synchronized for a simulation

I want to know if using volatile in this scenario will give better performance than using synchronized, specifically for the ...
1
vote
1answer
88 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 ...
2
votes
1answer
985 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? ...
3
votes
2answers
270 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 ...
7
votes
4answers
441 views

Handling messages from a server

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 ...
2
votes
1answer
4k views

Boost Threads - Producer Consumer threads with synchronization

Please review this for concurrency correctness: ...
3
votes
4answers
2k 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 ...
9
votes
0answers
310 views

Concurrency limit map in Go

Task: per host concurrency limits for web crawler (map[string]Semaphore). I considered chan struct{} (chan bool) approach, but ...
3
votes
4answers
378 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 ...
4
votes
2answers
461 views

Maintaining a count with two threads using conditional variables

This is just a program to show the use of conditional variables when two threads are involved. One thread wants a non-zero value of count, and other thread is ...
2
votes
1answer
501 views

Webservice methods using EclipseLink and database entities

I am wondering if this is a good and correct way to write the implementation of two web service methods (get/set methods). The setPerson method can be called from ...
6
votes
2answers
5k views

Thread-safe std::map accessor

After learning that std::map containers are not inherently atomic and therefore not thread-safe (check out this related Stack Overflow question and usage example), ...
13
votes
5answers
11k views
2
votes
1answer
721 views

Resource locker in Qt

The idea is to lock resources in C# or Java using Qt: lock(obj){/*process with locked obj*/}` Now I see the problem with deleting ...
5
votes
2answers
2k views

Synchronization of an ODBC connection

Since I'm venturing more and more into the multithreading, I now need to think about how to protect my precious OdbcConnection from breaking at random times. The ...
7
votes
1answer
547 views
4
votes
2answers
700 views

Making sure all elements are processed in a JQuery call

I have a piece code similar to below: But I keep having this nagging feeling that there has to be an easier way! Any ideas? ...
16
votes
3answers
16k views

Determining if a 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, but there is a nagging doubt I am ...