locking

Pure-Ruby concurrent Hash

What's the best way to implement a Hash that can be modified across multiple threads, but with the smallest number of locks. For the purposes of this question, you can assume that the Hash will be read-heavy. It must be thread-safe in all Ruby implementations, including ones that operate in a truly simultaneous fashion, such as JRuby, an...

Do I need to syncronize thread access to an int

I've just written a method that is called by multiple threads simultaneously and I need to keep track of when all the threads have completed, the code uses this pattern: private void RunReport() { _reportsRunning++; try { //code to run the report } finally { _reportsRunning--; } } This is the only p...

Teradata locks - How to know if a table is locked ?

Is there a way to know if a table is locked and what kind of lock is currently on a table? I was hoping for something through the DBC tables in teradata, but I can't find any reference to anything like this. I have normal user access and the DBA is no help. Thanks. ...

VB.NET Program Locks Up with Internet Explorer Opened

I'm using Visual Studio 2008 and developing a VB.NET application. I'm having strange lockup problems with my program, but only when Internet explorer 8 is opened. When I cover my form with another window and then uncover it, I find that it has locked up. My program has no references to IE and the only thing it even has to do with IE is ...

How do I lock the country down in Google Maps

How would I make it so you cant drag outside of the UK in google maps? Can you lock it down to a certain area, as I'd like to be able to drag around the UK but not outside. Ta Chris ...

How can I copy a locked mySQL table?

I am trying to rotate out an innoDB table which has a high number of transaction, so I need to lock all the tables involved. With the tables locked I cannot use RENAME to move data around using auxiliary tables. And if I do an INSERT, then I have to worry about the integrity of the ids. Any suggestions? Is this even possible ...

SQL Query with Table Locking

I am having an argument with a developer colleague on the team. Problem: SQL query X runs for 1 second on the test system, but for an unknown amount of time on live system (150 users can run queries at the same time). The query causes locks on 8 tables, of which 7 are useless. His idea is to put a WITH (NOLOCK) on the 7 tables so there ...

Why I can't insert new row into partially locked table in MySQL 5 InnoDB?

In manual it said that InnoDB has row-level locking, so why if I select some of the rows with FOR UPDATE statement it won't let me insert new row into that table? New row shouldn't be locked after all, it wasn't selected. ...

Reentrant locking.

A bit of help please, consider the bit of code below. public class Widget { public synchronized void doSomething() { ... } } public class LoggingWidget extends Widget { public synchronized void doSomething() { System.out.println(toString() + ": calling doSomething"); super.doSomething(); } } I ...

call pthread_cond_broadcast with mutex held or not ?

With a pthread_cond_t we have to associate a mutex, When signalling the condition I've seen code such as pthread_mutex_lock(&mutex); //code that makes condition true pthread_cond_broadcast(&cond); pthread_mutex_unlock(&mutex); and pthread_mutex_lock(&mutex); //code that makes condition true pthread_mutex_unlock(&mutex); pthread_...

SQL Server table isolation level and lock issue

Hello everyone, For the same ADO.Net statement, I want to make sure my understanding of isolation level and lock is correct. In default SQL Server isolation level (read committed), after read each row, the row will unlocked; If I raise isolation level to repeatable read, the lock (on the whole table? or some other level lock?) will be...

How can I lock shared files on a linux network in Perl?

I have mounted a cifs file on two Linux machines. I have a Perl script which can modify the shared file. How do we lock the file over network in this scenario? ...

Synchronization of SortedDictionary.iteri using readlock and writelock

let info = new SortedDictionary<string, string> ... Thread A -------- info.Add("abc", "def") Thread B -------- info |> Seq.iteri (fun i value -> ... Where do I place the readLock when I use the iteri function? ...

Chain Locking via Lock

Hi Guys, It is mentioned that one of the advantages of Lock (java.util.concurrent.locks.Lock) over intrinsic lock is that Lock facilitates "chain locking". Chain locking being, hold a lock for A, then acquire B, after acquiring B release A and then acquire C ... I am just curious, have you guys encountered any situation in which the u...

Sqlite database locked

I'm using asp.net c# and upload a SqLite database to a server and then I do some inserting and updating. The problem is that sometimes (I think it's when somethings go wrong with the updating or so) the database gets locked. So the next time I try to upload a file again it's locked and I get an error saying "The process cannot access the...

How can I prevent Visual Studio from locking the xml documentation files in the bin directory?

My visual studio solution includes a web application and a unit test application. My web application uses log4net. I want to be able to use msbuild from the command-line to build my solution. However, whenever I build the solution from the command-line, I get build errors because it can't copy log4net.xml to the test project's bin direct...

Is it possible to automatically release a lock in PostgreSQL?

I am testing the fault tolerance of an ActiveMQ system configured as JDBC Master/Slave. In this setup there is one postgres database and two brokers--one is the master broker, the other is a slave broker. The way this mechanism works is the master takes out an exclusive lock on a table in the db. The slave tries to do this also and waits...

If I lock when writing to a variable, do I also need to lock when reading, if the read is otherwise atomic?

I have a class with code as follows private readonly object m_lock = new object(); private IClient m_client private object m_context; When setting the client and context, I lock as follows lock(m_lock) { m_client = theClientFromSomewhere; m_context = contextObject; } My question is, if I only need to get the m_client by it...

Lock profiling in 2.6 linux kernel

How can I do the lock profiling (spin and other kind of locks) in 2.6 Linux kernel? I want to get the lock contention numbers for few locks which I have added in my module. Is there any .config option which I can enable and get the profile or any other tool? ...

php blocking when calling the same file concurrently

hi guys, i'm having some really strange problem. i wrote a filemanager in PHP with the ability to download files -- which works fine. the whole script is built as one big file. now, while downloading a big file i'm not able to use the script at the same time for, say, browsing folder contents. it does nothing but keep loading. as soon ...