Tagged Questions

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).

learn more… | top users | synonyms

6
votes
1answer
222 views

Updating the UI with a timer - code intended to help teach

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 stackoverflow question. The idea is that there's some data that is updated ...
4
votes
2answers
282 views

Singleton necessary in DAO

I am using a singleton in my DAO. Would I be better with static methods? Also, should I be worried about synchronization of the singleton and my data statures? ...
4
votes
2answers
97 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
295 views

Portable C++ boost::iterprocess::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
722 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
79 views

Social Share count

I am creating a social sharing counter plugin for my WordPress blog. I want to fetch the counts of number of likes, shares, Facebook comments (I am using Facebook comment box), twitter tweet counts ...
3
votes
1answer
51 views

Should I worry about 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
182 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? If ...
5
votes
2answers
3k 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 ...
5
votes
2answers
156 views

Optimize a synchronization with remote web service

I am writing a method to synchronize the local Core Data entities with a remote web service (in this case Parse.com). To update changed or created objects, I fetch all where the "updatedAt" date ...
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 ...
1
vote
1answer
162 views

Importing Markdown Files - Code Efficiency?

I'm building a rails app that, among other things, imports text markdown files as blog posts. The idea is that the truth is in the markdown files, so any time those are edited, created, or deleted, ...
1
vote
0answers
201 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 ...
3
votes
0answers
812 views

Python files sync

I'm trying to do a one-way directory sync. Given a list of existing files in a dir, I'd like to make the files in the dir equal a new list of files. There will be subdirs under the dir. Because ...
2
votes
2answers
981 views

Implementing semaphore - is this right?

I am learning to use semaphores and below is a small scenario which I've tried to implement. Its behaving weird in a way. After sem_wait() gets unblocked first time, its not getting blocked again and ...
1
vote
4answers
382 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
130 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
72 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
788 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
152 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
395 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 ...
1
vote
1answer
337 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 ...
7
votes
4answers
408 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
2k 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. ...
3
votes
4answers
1k 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 ...
6
votes
0answers
181 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
253 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
188 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 ...
2
votes
1answer
311 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 ...
3
votes
1answer
605 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: ...
6
votes
2answers
3k 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), ...
7
votes
4answers
5k views
2
votes
1answer
455 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. ...
2
votes
0answers
2k views

Gmail contacts API connection

I created this class that connects to Gmail contacts, and enables you to add/edit/delete the contact. I'm curious to see what others think of my code. If you see any areas for improvement, that ...
4
votes
2answers
1k 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. ...
5
votes
1answer
477 views
3
votes
2answers
510 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? ...
13
votes
3answers
11k 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 ...