synchronization

messed up using do_futex?

I'm getting a weird error. I implemented these two functions: int flag_and_sleep(volatile unsigned int *flag) { int res = 0; (*flag) = 1; res = syscall(__NR_futex, flag, FUTEX_WAIT, 1, NULL, NULL, 0); if(0 == res && (0 != (*flag))) die("0 == res && (0 != (*flag))"); return 0; } int wake_up_if_any(volatile ...

Can multiple classes serialize the same object in Java?

I am serializing an ArrayList in 2 classes: private void serializeQuotes(){ FileOutputStream fos; try { fos = openFileOutput(Constants.FILENAME, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(quotesCopy); oos.close(); }...

How can my AIR app communicate with my server?

I want my app to communicate with with server. I want the app to store something like notes and contacts. They can run the app on any system, and get their contacts on any machine by entering their username and password... As you can see authentication security of user's data is important. I am considering using Google App Engine as the...

Java Equivalent of .NET's ManualResetEvent and WaitHandle

Hello fellow StackOverflowers (<--bad pun), I would like to know if Java provides an equivalent of .NET's classes of ManualResetEvent and WaitHandle, as I would like to write code that blocks for a given timeout unless an even is triggered. The .NET classes of WaitHandle and ManualResetEvent provide an nice, hassle-free interface for t...

How to guarantee signal delivery from multiple children

As part of a Linux benchmark application, I have a parent process that forks multiple children that will each perform a task in parallel. I'm using signals to coordinate between them since I'm looking for as accurate of timing as possible. Each child will prepare for the test, then enter a 'barrier' controlled by the parent via signals...

Locking scheme a hack

How's this look: class HugeHack { HugeHack() : m_flag( false ) { } void Logout( ) { boost::lock_guard< boost::mutex > lock( m_lock ); m_flag = true; // do stuff that in a perfect world would be atomic with library call and onLogout // call a library function that waits for a thread to finis...

Does rsync ignore file timestamps and automatically overwrite on client if file is different on server?

I'm trying to set up two PCs to sync a folder tree so that each PC will have a copy of the tree with the most recent updates to each file. I considered setting up Mercurial but realized I don't really care about versioning (especially since I'm low on disk space), and that rsync sounds like it does more of what I want - just keeping fil...

C++ synchronization guidelines

Does anyone know of a decent reference for synchronization issues in C++? I'm thinking of something similar to the C++ FAQ lite (and the FQA lite) but with regards to concurrency, locking, threading, performance issues, guidelines, when locks are needed and when they aren't, dealing with multithreaded library code that you can't control,...

Oracle data synchronization in live environment.

What are known reliable tools for syncing huge amounts of data between Oracle DB instances in live environment? Requirements are that the host with live data is running in a live environment, i.e. the database is updated. Receiving host is offline, and will go online only when data sync is complete. Most of the data is stored in blob c...

keeping home directories synchronized on to Linux Boxes

I have two servers, computer A and computer B, both running Linux. I need to write a program or a shell script which will continuously monitor the contents of my home directory on computer A and if anything changes, copy the changes to my home directory on computer B such that both home directories are always the same. (Any changes made ...

MySQL Database synchronization

Is there any free MySQL synchronization tool out there? I need to synchronize the database structure across servers. Data synchronization is not necessary (but is a plus). It needs to be free (for non commercial use), not a free trial. Edit: None of the answers so far has worked, were free, or a suitable to my needs. ...

Suggestions for synchronization of lists in Silverlight

Hi, We are creating a business application (Silverlight 4) at our company where we, in several of our views, use the functionality to synchronize two lists of some kind. More precise we are, at the moment, using two list boxes (one source and one target) and two buttons (one add and one remove). Both the source list and the target list...

Syncing Drupal site between dev, staging and production

Hi all, Often after a Drupal (6.x) site is launched, I have people starting to sign up and enter their own content. Whenever there is need for an upgrade, the database on production is copied to dev and then the development is done on dev, later get pushed to staging for client's approval. When the site is eventually ready to go live...

MySQL table synchronization

I have a server that constantly writes SQL queries it executes to a textfile. I want this textfile to be read by a second server, execute the queries there, and remove them from the textfile. This is done in an attempt to keep those 2 servers virtually synchronous with each other without changing existing code. ...

C++ - basic thread question

Hello! I have a simple threading question - how should the following be synchronized? I have main thread and a secondary thread that does something only once and something - more that once. Basically: Secondary thread: { Do_Something_Once(); while (not_important_condition) { Do_Something_Inside_Loop(); } } I want t...

Do I need extra synchronization when using a BlockingQueue?

I have a simple bean @Entity Message.java that has some normal properties. The life-cycle of that object is as follows Instantiation of Message happens on Thread A, which is then enqueued into a blockingQueue Another thread from a pool obtains that object and do some stuff with it and changes the state of Message, after that, the objec...

sem_wait not working as expected?

Follow up question to my pervious question: http://stackoverflow.com/questions/3579860/conditional-wait-with-pthreads I changed my code to use semaphores instead of mutex locks and conditional signals. However, I seem to have run in to a condition that I cannot explain. Here is the abstract function thread work { while (true) s...

iphone: how can i synchronize the contents of 2 NSMutableArrays?

I currently have an NSMutableArray which stores a collection of Video objects. Each Video object has an ID and TITLE. I also have another NSMutableArray of video objects generated from parsing an XML API call. When the user hits a 'synchronize' button, I want the system to be able to figure out the minimum number of operations needed ...

Serial Task Executor; is this thread safe?

I have a class that I've created to allow asynchronous sequential execution of tasks, using the ThreadPool as the means of execution. The idea is that I'll have multiple instances running serial tasks in the background, but I don't want to have a separate dedicated Thread for each instance. What I'd like to check is whether this class ...

What important difference exists between Monitor.TryEnter(object) And Monitor.TryEnter(object, ref bool)?

It seems that these code snippets ought to behave identically: 1: Monitor.TryEnter(object) if (Monitor.TryEnter(lockObject)) { try { DoSomething(); } finally { Monitor.Exit(lockObject); } } 2: Monitor.TryEnter(object, ref bool) - introduced in .NET 4.0 bool lockAcquired; try { Monitor.TryE...