synchronization

'Implicit' synchronization in java?

Hello, when I have a method like public void unsynchronizedMethod(){ callSynchronizedMethod(); //dosomestuff after this line } does it mean that all content, after calling callSynchronizedMethod() in the unsynchronizedMethod()-Method, is implicitly synchronized? ...

Synchronizing NSMutableArray for Thread Security ?

HI All, I have a Threaded application, in which there is a NSMutableArray, which contains the NSManagedObjects, Now i want my array to be accessed once at a time by any Thread. So how do i synchronize that array, or may be put locking mechanism on it. Thanks in Advance ... ...

Java: What object is more appropriate?

Hi, I am writing an application similar to a chat server-client pair. I am planning on having a central Object which will hold new messages received from clients until they are dealt with by the main thread. My application is multi-threaded. Each client will be on its own thread, so multiple threads will be adding messages to this cen...

Producer Consumer Chain and Thread Scheduling in .net

I've made a chain of 4 producer-consumer threads (forming a 4 step pipeline). To my amazement, all four threads are running in sequence, instead of concurrently!!! That is, the second thread mysteriously waits until the first thread is entirely done producing. The third thread mysteriously waits until the second thread is entirely done...

How does Thread.sleep() work when called from multiple threads.

Hi, sleep() is a static method of class Thread. How does it work when called from multiple threads. and how does it figure out the current thread of execution. ? or may be a more generic Question would be How are static methods called from different threads ? Won't there be any concurrency problems ? ...

multithreading hack

Hello, I am writing a numerical program that should be somewhat fast, and is also multithreaded. I have a class that represents a number, and I want to use in it a random number generator. Now, I don't really require my RNG to be a true RNG, I just need it to generate integers with even distribution between 0 and NMAX. So I have this i...

How to pull a Sharepoint List with a Rails app?

I would like to enable a rails app to pull from a sharepoint list in order to update a model. Has anybody meshed up these two things? ...

How do I sync an offline web app (HTML+JS+CSS) with my server?

Do I need to implement my own sync methods in order to make an offline web app (html+css+js) stay up to date with changes made on the server (and viceversa)? I'm using MySQL on the server side. I read http://stackoverflow.com/questions/3106191/ with some pointers but I think they're talking about native applications when they mention CF...

Should pthread_mutex static initialization using PTHREAD_MUTEX_INITIALIZER avoided?

Are there any known problems of initialiazing pthread mutexes statically using PTHREAD_MUTEX_INITIALIZER and passing them directly for locking? I read in some sites that this cannot be guaranteed on all platforms and also in the help page the below note is there: Note: Mutex initialization using the PTHREAD_MUTEX_INITIALIZER does not i...

How to protect init function of a C based library?

I have written a C based library and for it to work in multi-thread parallely, I create some global mutexes in the init function. I expect the init function to be called in the main thread before the library APIs are used in multi-thread. But, if the init function itself is called in multi-thread directly, then it is a problem. Is ther...

Locking in PHP to acheive a crtitical section - unexpected results with MySQL

The goal is to have a PHP script with a certain section of the code that can only be executed by one thread/process at a time. Some restrictions: semaphores not available on my system The manual mentions that flock() cannot be relied on in multi-threaded servers, so flock() is out. (confirmed this) So thought it would be possible (w...

MySQL or Microsoft Sync Framework Synchronization / Replication

I am creating an application that has one server and multiple clients. It is a c# app that uses ADO.NET Entity Framework 4 over a MySQL database. The clients need to get data from several database tables on the server. There are also 2 separate tables that need to be sent from the clients to the server. At some point, the client shoul...

Databases for easy comparison

We have an application which has metadata information stored in database (some tables with relations between). The metadata can be edited through web app or directly manipulating values in SQL Server database. The problem: metadata changes and needs to be merged between different environments (test, staging, production, etc.). There ar...

Are all Java Properties' methods fully synchronized?

I know that the Properties class is a sub-class of Hashtable. So all the inherited methods are synchronized, but what about the other methods of Properties such as store, load, etc? (Dealing specifically with Java 1.6) ...

Clojure STM ( dosync ) x Java synchronize block

What i the difference between Clojure STM ( dosync) approach and Java synchronize Block ? Im reading the code below from "The sleeping barber" problem. (http://www.bestinclass.dk/index.clj/2009/09/scala-vs-clojure-round-2-concurrency.html) (defn the-shop [a] (print "[k] entering shop" a) (dosync (if (< (count @queue) ...

Sync state of two NSMenuItems

Hi, I have two NSMenus with the same NSMenuItems. Only one NSMenuItem in its NSMenu should be selected. (Kind of like an NSMatrix). So I connected each NSMenuItem to the same action and added an iVar for the index of the item with the NSOnState. Inside the method I set the state of the item with the old index to NSOffState and the new o...

shared memory locking and process crash

Hi guys, I want try to understand better the problem of synchronization of shared memory. I have understood that interprocess synchronization can work differently on different operating system. The most difference is what's happening when a process that has locked the shared memory crash. Windows free locked named mutex after a process c...

Possible to synchronise AnimationDrawables in Android?

I need to synchronise two AnimationDrawables (using frame animations setup in xml). The developer article on AnimationDrawable speaks of no such thing, so I would like to know if it's even possible, and if not, how I could get the same effect using a different object perhaps? The two drawable objects are the same size and have the same n...

C# memory model and non volatile variable initialized before the other thread creation.

Hi, I have a question related to the C# memory model and threads. I am not sure if the following code is correct without the volatile keyword. public class A { private int variableA = 0; public A() { variableA = 1; Thread B = new Thread(new ThreadStart(() => printA())).Start(); } private void printA() { System.C...

Dead-locks in Java: When they occur?

I am working on an app for the J2ME and sometime it freezes completely and it takes quite some time for the AMS to close it. It seems to me like a dead-lock issue. Could you advise me as to what could cause dead locks? Would, for instance, calling a synchronized method of a object cause dead lock if it calls another synchronized method ...