synchronization

Is it safe to use local lock instead of shared lock for synchronization?

Hi Guys, I will try to explain the quetion by taking following 3 cases. CASE I: I was using shared lock for synchronization using something like this: private static final String SHARED_LOCK = "shared_lock"; private static int i = 0; private static int j = 0; void increment() { synchronize...

SQLite & C# ] How can I control the number of people editing a db file?

Hi, I'm programming a simple customer-information management software now with SQLite. One exe file, one db file, some dll files. - That's it :) 2~4 people may be going to run this exe file simultaneously and access to a database. Not only just reading but frequent editing will be done by them too. Yeahhh now here comes the one of ...

Thread synchronization/scheduling in perl

I have a perl object with a few functions in it. Each functions is called once from the main program. I would like to run some of the functions in parallel to save time. I can't run all of them together since some functions depend on the results of previous functions. I thought of something like this: For each function keep a flag tha...

Help with MS Access and SQL Server 2008

Hi, I need somebody to point me to the right direction, I have a MS Access DB that is updated by HP devices, and I have to sync it with the SQL Server 2008. I have a few Ideas, and I would like to know what do you think about this: Is there anything like triggers on access? if so can I comunicate with a SQL Server? Is there any way to...

User synchronization in WCF web service performing database operations.

Hi, I am new to wcf and I have written a wcf web service that performs operations on database like an update. The service is consumed by silverlight clients. When multiple users try to make certain change to an object, I want the wcf service to manage it. e.g. if a certain object is acknowledged(update operation in db) by one user, anoth...

order and barrier:what is the equivalent instruction on x86 for 'lwsync' on PowerPC?

My code is simple as below.I found rmb and wmb for read and write,but found no general one.lwsync is available on PowerPC,but what is the replacement for x86?Thanks in advance. #define barrier() __asm__ volatile ("lwsync") ... lock() if(!pInst); { T* temp=new T; barrier(); pInst=temp; } unlock...

How to keep databases synchronized between hosting account and a local testing server?

I have several databases hosted on a shared server, and a local testing server which I use for development. I would like to keep both set of databases somewhat synchronized (more or less daily). So far, my ideas to solve the problem seem very clumsy. Anyway, for reference, here is what I have considered so far: Make a database dump ...

Git remote repository (with files?)

Hi, I have a remote web server that I have full access to (ssh, git, etc.). I want to be able to edit files on my computer and push them to the remote server. When I use a bare repository it doesn't change the file, but when I use a non-bare repository it complains with the following message: remote: error: refusing to update checked o...

Multi-threading: How to 'Lock' an Object by One or More Threads

I have one 'main' thread that creates an array of objects of class SlowData. These objects are relatively slow to manipulate with. This is why, when I initially load them, they are filled with stub data. Immediately after each object in the array is loaded, I can display the array in the UI. Parallel with that, I initiate the computatio...

Synchronizing a java serial port connection using RXTX

I have a java program that continually listens for messages of a certain format on a serial port. When the sender application is not sending messages, it sends heartbeat messages in the following format: byte 1: 1 byte 2: 0xFE byte 3: 0xED bytes 4-255: 0 If the receiver application is started before the sender, everything functions co...

Replace critical section with SRW lock

If the application is targeted on Windows Vista or later, could we replace all critical sections with SRW locks? Since critical section is mutually exclusive, for usage it is equivalent to SRW locks in exclusive mode, right? According to MSDN, SRW is optimized both for speed and space. Is there any drawback for doing this? I'm not sure h...

file syncronization library

Hello I'm looking into C/C++ libraries (Win/Linux) that allow me to synchronize information over network. I want to run multiple instances of my program (on different PC's), and want to synchronize files locally instead of accessing files remotely over the network at a single location. If all instances are to maintain DB consistency it...

How to synchronize Read/Write to Stream ?

Greetings, I've got custom Telnet client in C#. I am using it to communicate with IMAP servers. It works as just write command, then get response. Test code: Telnet tc = new Telnet(); // setup server credentials const string server = "pop.nexlink.net"; const int port = 140; co...

Is concurrently overwriting a variable with the same value safe?

I have the following situation (caused by a defect in the code): There's a shared variable of primitive type (let it be int) that is initialized during program startup from strictly one thread to value N (let it be 0). Then (strictly after the variable is initialized) during the program runtime various threads are started and they in so...

Cross-process read-write synchronization primative in .NET?

Is there a read/write locking mechanism that works across processes (similar to Mutex, but read/write instead exclusive locking)? I would like to allow concurrent read access, but exclusive write access. ...

jQuery script supposed to run async but works only sync? why?

I have this small jquery script that does not work if I remove the 'async:false' part... And I don't understand why (the alert() part is there just to check if it works or not). My guess was it would work asynchronously but it just doesn't. Can somebody explain to me why? And what should I change to make it async? $(document).ready(func...

DAO methods and synchronized

The following are methods I currently have in an Abstract DAO class. If there are concurrent calls, are they safe as they are or should synchronization be used? I know synchronization should be used if there is a reference to an attribute outside the scope of a method but it's unclear to me how should things be handled with an outside re...

Java RMI and synchronized methods

(Please leave a comment if the point is not clear) I'm studying the book "Distributed Systems" (by Tanenbaum & Van Steen) and they say something that seems to conflict to what seems to be instead thought by many on Java RMI and synchronized methods. What I thought is that using a synchronized method on a Remote Object implementation (s...

.NET: How to ensure that Thread 1 can see what Thread 2 has written in a field?

Environment: .NET 3.5 SP1. I've got two threads: UI thread and a background worker thread. The background worker thread periodically updates some fields in a shared object and the UI thread checks them. Nothing spectacular - just the progress, return values and thrown exceptions. Also the worker thread raises some events on the UI threa...

keeping two databases in-sync (asynchronously)

I'm thinking of adapting a current database application to have a persistent web-based component. The idea is to have a local client version that can be run whether or not the client has connectivity. The data for the application is stored in a local database. What I'd like to have is that, whenever the client does have connectivity, the...