locking

My C# app is locking a file, how I can find where it does it?

I'm writing code that check files path calculate hash (SHA1) and copy them. I made sure that I do not lock them like for example using public static string SHA1(string filePath) { var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); var formatted = string.Empty; using (var sha1 = new SHA1Managed...

thread Locking/unlocking in constructor/destructor in python

I have a class that is only ever accessed externally through static methods. Those static methods then create an object of the class to use within the method, then they return and the object is presumably destroyed. The class is a getter/setter for a couple config files and now I need to place thread locks on the access to the config fil...

Simplest possible implementation of Lock in java.

Possible Duplicate: Peterson algorithm in Java? I am trying to implement a lock in Java (lock interface) in the lines of petersen method. What is the simplest possible non-reentrant implementation to guarantee mutual exclusion. flag[0] = 0; flag[1] = 0; turn; P0: flag[0] = 1; P1: flag[1] = 1; ...

oracle sleep or lock to check the processing

I just want to see whether the data is getting inserted on the table or not.. So i have written like this: select count(*) from emp; dbms_lock.sleep(1); select count(*) from emp; So that it will sleep for 1 min . Even after sleep if the 1st count and 2nd count are different then the data is getting inserted into the table. Otherwise...

Using boost::lock_guard for simple shared data locking

I am a newcomer to the Boost library, and am trying to implement a simple producer and consumer threads that operate on a shared queue. My example implementation looks like this: #include <iostream> #include <deque> #include <boost/thread.hpp> boost::mutex mutex; std::deque<std::string> queue; void producer() { while (true) { ...

How do I use `lock_hash_recurse` in Perl?

In continue to the discussion here, I'm havind some trouble with lock_hash_recurse as illustrated below: #!/usr/bin/perl use strict; use warnings; use Data::Dumper; use Hash::Util qw (lock_keys); my $hashref = {A=>1, B=>{CC=>22, DD=>33}}; lock_keys(%{$hashref}); # this is OK Hash::Util::lock_hash_recurse(%{$hashref}); # this fails: "...

Locking without hardware support

I think most locking techniques assumes or makes use of hardware support for atomic transactions. I remember reading about some locking/synchronization algorithms which doesn't need such support, but can't really recall them (token-based or something). Do they exist? If so can I get some links please? Thanks Jeenu ...

Inter-process lock

I am writing a system for automatically recalculating the results of costly methods, and then storing them in a cache. The cache may be distributed, meaning (obviously) multiple processes can access it. On the first invocation of the method to cache the result for, I want to spawn a thread that will periodically recalculate the result o...

java applet domain locking

I need to be able to lock a java applet to a specific domain or range of domains. I know that it is possible to do this with flash .swf files see article. I need to be able to do this with a java applet or jar. If anyone has any information on this it would be much appreciated. ...

Implementing a lock using GM_getValue GM_setValue

I've got a greasemonkey script that, when it runs, checks to see if an update is available, and prompts the user to download the update if so. This normally works fine, except that if a user opens multiple tabs simultaneously (say, on starting the browser, or using "Open All in Tabs" for a bookmark folder), the greasemonkey script will ...

How to Create lock on file And not Allow the WINDOWS to open a file?

Hi friends I want to make a program for management the Image files with DELPHI . now,I want create a password on any files that user select with my program until these files not opened with Windows itself. How to solve this problem? Tanks to all. ...

Are there any mysql storage engines with row locking, and fulltext?

Im using fulltext for searches on my site, but there are a lot of updates being done to the table also, which contains 700,000 records. these updates are usually done via cron, by a script that runs every 10 minutes and commits changes from a temporary table where I simply INSERT all the changes for speed purposes, since updating the liv...

settings a SVN server so as to enable lock-modify-unlock mechanism of version control

We are currently using SVN in the checkout-modify-merge mechanism and instead I want to re-configure the SVN server so that we change this to lock-modify-unlock mechanism. We use Tortoise SVN client and I saw that it is possible to individually change the property of single files to enforce the "needs-lock" property but this is too labor...

A WAIT lock without a corresponding GRANT

I'm trying to investigate a performance problem at a client site. I've looked through the blocking data for the site and come up with a couple of SPIDs to investigate over a time period. I've then looked at the data from sys.syslockinfo and found that one of the problem SPIDs has a WAIT on an Intent Exclusive Table lock. I tried to find ...

locking on a cache key

I've read several questions similar to this, but none of the answers provide ideas of how to clean up memory while still maintaining lock integrity. I'm estimating the number of key-value pairs at a given time to be in the tens of thousands, but the number of key-value pairs over the lifespan of the data structure is virtually infinite ...

fopen file locking in PHP (reader/writer type of situation)

I have a scenario where one PHP process is writing a file about 3 times a second, and then several PHP processes are reading this file. This file is esentially a cache. Our website has a very insistent polling, for data that changes constantly, and we don't want every visitor to hit the DB every time they poll, so we have a cron proces...

Lock all controls except one without changing their appearance

Hi everyone! I need to Lock all controls of my window except one, if I write Me.MainGrid.IsEnabled = False I obtaind the result but many controls change the appearance. I need they maintain the current appearance, like when I open a WinDialog with ShowDialog. To redefine the style af all controls is a too much "chinese" work. There is ...

Identity columns for multitenant database schemas

I'm creating a multitenant app where some of the tables need to have sequentially assigned integer values. The ordering is done independently for each tenant. As a concrete example, consider a Student table with a RegNumber column. RegNumber has to be assigned sequentially, but the sequence is local to each tenant. The solution I'm thin...

Zend Auth locked session

Hi there, i nearly frustrated with how Zend handling session. here is my case. i write a auth plugin that always check the the user credential utilize Zend_Auth. and when invoke hasIdentity function from zend auth, it will automatically start the session. and the problem come when i have a long process that i need to execute. the sess...

Mysql master log pos changes during a global lock?

Hello, I have to set up a new mysql replication replicating two databases. So I have this script which locks tables, makes a dump and unlocks them. runme.sh mysql -uxxx -pxxx < 1.sql >> logpos.txt mysqldump -uXXX -pXXX db1 > db1.sql mysqldump -uXXX -pXXX db2 > db2.sql mysql -uxxx -pxxx < 2.sql >> logpos.txt first sql file locks tabl...