locking

What interprocess locking calls should I monitor?

I'm monitoring a process with strace/ltrace in the hope to find and intercept a call that checks, and potentially activates some kind of globally shared lock. While I've dealt with and read about several forms of interprocess locking on Linux before, I'm drawing a blank on what to calls to look for. Currently my only suspect is futex()...

What is equivalent of the C# lock statement in PHP?

For concurrency and ensuring the integrity of the data, how would you obtain a mutual-exclusion lock for a given object? Would you need to use locking within the database, or a file, or does PHP support something like this? ...

File remains locked even after calling filestream.close

Hi, In my application, i am downloading file from DMS system to my server. Once the file gets downloaded, on some environment, the iis keeps lock of the file and when the application tries to redownload the file and put the file on same location, an error is generated that file is being used by another process. Following is the code : ...

Should access to a shared resource be locked by a parent thread before spawning a child thread that accesses it?

If I have the following psuedocode: sharedVariable = somevalue; CreateThread(threadWhichUsesSharedVariable); Is it theoretically possible for a multicore CPU to execute code in threadWhichUsesSharedVariable() which reads the value of sharedVariable before the parent thread writes to it? For full theoretical avoidance of even the remote...

Android:Whats the code for enable/disable auto-lock feature?

I'm making an app on Android where user has to set the value of a ToggleButton in order to set the Auto-Lock feature to ON or OFF. Any clue whats the API and relevant code? ...

Multiple servers checking and writing flag in database

Hi, I have an environment with 4 servers and 2 oracle database servers which have streams between them for instant 2 way replication. I have a servlet (I cannot control which of the 4 servers it goes to) which checks if a job is running and if not it starts the job in a thread. Only one of these jobs should be running at any time. I ...

(Google AppEngine) Memcache Lock Entry

Hi, i need a locking in memcache. Since all operations are atomic that should be an easy task. My idea is to use a basic spin-lock mechanism. So every object that needs locking in memcache gets a lock object, which will be polled for access. // pseudo code // try to get a lock int lock; do { lock = Memcache.increment("lock", 1); } wh...

When I update/insert a single row should it lock the entire table?

I have two long running queries that are both on transactions and access the same table but completely separate rows in those tables. These queries also perform some update and inserts based on those queries. It appears that when these run concurrently that they encounter a lock of some kind and it’s preventing the task from finishing ...

does a getter function need a mutex?

I've a class that is accessed from multiple threads. Both getter and setter functions are guarded with locks. Are the locks for getter functions relly needed? Why? class foo { public: void setCount (int count) { boost::lock_guard<boost::mutex> lg(mutex_); count_ = count; } int count () { boost::lock_...

python Client hangs when no data to receive from server and hangs in that thread w/o letting client send.

I am trying to figure out how to get my client to send and receive data 'simultaneously' and am using threads. My problem is that, depending on the way I set it up, the way here it waits for data from the server in the recieveFromServer function which is in its own thread and cannot stop it when nothing will be sent. The other way it j...

"SELECT ... FOR UPDATE" not working for Hibernate and MySQL

Hi, We have a system in which we must use pessimistic locking in one entity. We are using hibernate, so we use LockMode.UPGRADE. However, it does not lock. The tables are InnoDB We have checked that locking works correctly in the database (5.0.32), so this bug http://bugs.mysql.com/bug.php?id=18184 seems to be no problem. We have chec...

Why is my Bamboo build blocked by a Java subprocess?

I am working on a legacy Java Enterprise server project, trying to set up nightly builds. We are using Java 5, Maven 2, JBoss 4.2 and Atlassian Bamboo 2.1.5. The idea is that we have a Bamboo agent on one of our dev servers, and the Maven build is configured to hard deploy the resulting .ear file, then restart the server. (We can't use s...

Multiple unique counters in a table

Hi all, I have a problem where I need to keep and increment an object number field in a table, however this number should be unique within given logical domain, not across table globally. An example would be multiple Businesses scheduling multiple Jobs; Job.Number should be unique within a business. So I basically need to make sure t...

.NET Threading & Locks & Waiting

I am attempting to make my GUI thread remain responsive-ish during long running operations. These operations must be synchronous as they are usually operations which are required to finish before the requested operation can complete. I was attempting to do this with a background worker, monitors and a lock object. Essentially I want to...

Using JMS as a distributed lock manager?

I have a system where some loosely coupled components are communicating by exchanging messages over JMS. I am now looking at a new requirement which leads to some shared resource needing protection from access by two or more components at the same time (more or less an instance of the reader/write problem). I am looking for a way to coor...

What is the least intrusive locking mechanism I can use to prevent rows from being inserted in an Oracle table?

I have a parent/child relationship defined which, unfortunately, cannot be maintained via a foreign key. Parents and children are stored in the same table. The parent/child relationship is identified by a column "ITEM_ID". A child ITEM_ID consists of its parent ITEM_ID and then what we can effectively think of as the child's unique id...

Test a lock with out acquiring it?

I have objects, they get locks. I want to test if they are locked without acquiring a lock. The idea is if I TryEnter() they i have to Exit() if true to only check the lock correctly. Seems like a really basic question, how is it done? ...

Java threads internals

I have been studying internals of Java for quite some time. I am curious to learn and understand how threading/locking takes place in Java. So, in order to access a synchronized method or a synchronized block, the thread has to acquire the lock on the object first. So, now, here is what I need a bit more light. So, whenever the thread...

Footprints SQL Server

What does it mean by footprints in SQL Server? here's a snippet from MSDN "reduce the lock footprint of expensive queries" LINK ...

zookeeper - locking one-of-many

I have a set of resources each of which has a unique identifier, and each resource element must be locked before it is used, and unlocked afterwards. The logic of the application is: lock any one element; if (none locked) then exit with error; else get resource-id from lock use resource unlock resource end Zookeeper loo...