locking

MySQL synchronization questions

I have a MySQL DB which manages users’ accounts data. Each user can only query he’s own data. I have a script that on initial login gets the user data and inserts it to the DB. I scheduled a cron process which updates all users’ data every 4 hours. Here are my questions regarding it: (1) - Do I need to implement some kind of lock mecha...

SearchDisplayController & Coredata Search locks the application while loading, what can i do?

Hello friends. I am building an application with coredata. Its nearly finished but i have a problem. I want to put a search section on my application. I did it now and it is working, but there is something weird and i could not solve. When clicked on the search button, i am preparing my Predicates and search my database, and show the ...

MySQL Error 1205: Lock wait timeout exceeded

I'm using SQLyog to sync a production database to a dev db. On 4 tables, I'm getting: Error No. 1205 Lock wait timeout exceeded; try restarting transaction Researching the web seems to indicate that a transaction has begun, locked tables, but has not committed. One post said to SHOW PROCESSLIST; but the only processes appear to be my o...

Sharing file locks

I am currently working on a file processing service that looks at a fileshare, where files are uploaded to via FTP. For scalability I've been asked to make this service to be able to be load balanced, so the service has to expect that other services on different machines may also be trying to process these files. OK, so I thought I sho...

Remove entries from dictionary using LINQ - locking

Hi I have a static dictionary which holds authentications for a web service. I'm running a timer (hence the TimerCallBack sig on the method below) to remove those authentications which have been dormant for a period. I'm not quite sure of the locking behaviour I need in relation to linq. Here's my code thus. I'm slightly concerned th...

Explain locking behavior in SQL Server

Why is that, with default settings on Sql Server (so transaction isolation level = read committed), that this test: CREATE TABLE test2 ( ID bigint, name varchar(20) ) then run this in one SSMS tab: begin transaction SH insert into test2(ID,name) values(1,'11') waitfor delay '00:00:30' commit transaction SH and this one simultaneou...

increment a count value outside parallel.foreach scope

How can I increment an integer value outside the scope of a parallel.foreach loop? What's is the lightest way to synchronize access to objects outside parallel loops? var count = 0; Parallel.ForEach(collection, item => { action(item); // increment count?? } ...

Detect workstation/System Screen Lock using Python(ubuntu)

Is there anyway that we can detect when the system/screen gets locked and notify some event to trigger in Ubuntu ? ...

How to use lock in openMP?

I have two piece of C++ code running on 2 different cores. Both of them wirte to the same file. How to use openMP and make sure there is no crash? ...

How to avoid SQLiteException locking errors

I'm developing an android app. It has multiple threads reading from and writing to the android SQLite db. I am receiving the following error: SQLiteException: error code 5: database is locked I understand the SQLite locks the entire db on inserting/updating, but these errors only seems to happen when inserting/updating while I'm runnin...

Concurency issues with scheduling app

Our application needs a simple scheduling mechanism - we can schedule only one visit per room for the same time interval (but one visit can be using one or more rooms). Using SQL Server 2005, sample procedure could look like this: CREATE PROCEDURE CreateVisit @start datetime, @end datetime, @roomID int AS BEGIN DECLARE @isFreeRoom I...

How concurrency mantained by Oracle for PL/SQL Procedure?

How oracle maintained concurrency of PL/SQL Program? i.e. If user A and B both execute same procedure (Contains DML operations) @ same time. ...

Using lock(obj) inside a recursive call

As per my understanding a lock is not released until the runtime completes the code block of the lock(obj) ( because when the block completes it calls Monitor.Exit(obj). With this understanding i am not able to understand the reason behind the behaviour of the following code. private static string obj = ""; private static void ...

pthreads: reader/writer locks, upgrading read lock to write lock

I'm using read/write locks on Linux and I've found that trying to upgrade a read locked object to a write lock deadlocks. i.e. // acquire the read lock in thread 1. pthread_rwlock_rdlock( &lock ); // make a decision to upgrade the lock in threads 1. pthread_rwlock_wrlock( &lock ); // this deadlocks as already hold read lock. I've re...

How to test if a thread is holding a lock on an object in C#?

Hi, Is there a way to test if the current thread is holding a monitor lock on an object? I.e. an equivalent to the Thread.holdsLock in Java. Thanks, ...

When do c++ stream objects use mutexes?

In the answer to this question ovanes states: Please be aware that boost::lexical_cast is much slower as atoi. I also use it very often in a performance non-critical code. The problem with lexical_cast is that it uses stringstream for conversion. If you are working in a multi-threaded environement any stream class from ...

APC locking mechanisme alternative for win32

I want to use APC for php for storing and fetching values (function calls and return values) between a endless running php process and multiple client processes. The endless running process constantly checks for newly stored values. I am running php as a Apache module on WinXP. For each APC function call a apc.lock.* file is placed in th...

Lock Acquisition Order

Hi, With the following code, if a thread calls LoggingWidget.doSomething(), what is the order of lock acquisition that the thread has to go through? (i.e. does it get the Lock on LoggingWidget first, and then gets the lock on Widget ? ) public class Widget { public synchronized void doSomething() { } } public class LoggingWidg...

Regarding DB Locks and Lock Escalation SQL Server 2008

Dear Gurus I have seen many articles and Questions/Answers Regarding Lock Escalation but following things are still vague. Please answer to the specific required information. If Lock Escalation is disabled will there be Intended Locks on higher resources like on Page or Table??? If a Lock(IX) is placed on Page can another connection a...

SQLite file locking and DropBox

I'm developing an app in Visual C++ that uses an SQLite3 DB for storing data. Usually it sits in the tray most of the time. I also would like to enable putting my app in a DropBox folder to share it across several PCs. It worked really well up until DropBox has recently updated itself. And now it says that it "can't sync the file in us...