locking

NUnit locks my executable so that I can't recompile it

When I load my executable in NUnit, the application appears to be "locked". I run the tests but when I want to make some modifications to them, I have to close NUnit first otherwise my compilation will fail. Is there any workaround for this? EDIT According to Process Explorer, the only process accessing my executable right now are "nu...

How to lock android buttons/phone from code (screen lock)?

I have made a simple Android app with a pin-code/screen lock. The user have to write a password to lock the phone and then repeat it to unlock the phone. The problem is that the user still can press back, home (etc) to exit the app without writeing the code. How can I prevent this? ...

Lock Problem in ASP.NET when debugging

I am using lucence.net which creates a file as a 'lock'. From what i can tell it simply creates a file to write to and if it cant the db is locked. I get the exception below I call lucence_init() excepting it to happen once. I call it in Application_Start after i set the current working folder and other stuff. I cant tell when this hap...

What happens to a Thread that fails to acquire a lock?

What happens to a Thread that fails to acquire a lock (non-spin)? It goes to the BLOCKED state. How does it gets executed again? Lock lck = new ReentrantLock(); lck.lock() try { } finally { lck.unlock(); } ...

futex-based 4-byte single-writer/multiple-readers lock

Looking for a minimal, futex-based implementation of a single-writer/multiple-readers lock requiring no space overhead beyond a single 4-byte futex state variable. Some background: I have an application which will embed a lock within each of tens to hundreds of millions of small objects. Because of the very fine grained nature of the l...

How can I ensure only one copy of a Perl script is running at a time?

I need to ensure that only one copy of my Perl script is running at a time. According to the suggestions here I wrote a sub to do the check: sub check_instances { open my $fh, '<', $0 or die $!; unless (flock($fh, LOCK_EX|LOCK_NB)) { print "$0 is already running. Exiting.\n"; exit 1; } } But it doesn't ...

Thread pool shared resource locking problem

I have a UDP based application that is implemented using a thread pool. Messages are pushed onto a queue and the thread pool is woken when there are things to do or messages on the queue. The thread pool processes each of the messages and hands them off to session objects which hold some state. i.e. the UDP packets are part of a sessio...

Multi-threading problem when checking the list Count property

Hi All, I have List newJobs. Some threads add items to that list and other thread removes items from it, if it's not empty. I have ManualResetEvent newJobEvent which is set when items are added to the list, and reset when items are removed from it: Adding items to the list is performed in the following way: lock(syncLock){ newJobs...

Mutex lock: what does "blocking" mean?

I've been reading up on multithreading and shared resources access and one of the many (for me) new concepts is the mutex lock. What I can't seem to find out is what is actually happening to the thread that finds a "critical section" is locked. It says in many places that the thread gets "blocked", but what does that mean? Is it suspende...

PThread RWLock Deadlocking with Recursive Locks

I've been working on a small sand-boxed example to help me figure out how to use rwlocks. Everything seems fairly straightforward, however I'm getting deadlocks in my example every once and a while and don't understand why it's happening. I've put the code example on pastebin because it's more than a few lines of code: http://pastebin.o...

WTF is this Access bug?

Tested on Access 2003 Pro (build 11.8321.8324) SP3. Steps to reproduce: create a new database. create a new form. put a button on the form. paste the following code in the button's Click event procedure: Debug.Print Workspaces.Count Debug.Print CurrentDb.Name close the code editor and form, saving changes. do not skip thi...

Share one variable between threads ?

Hi everybody ! i have this scenario: class MyClass { Producer p; Consumer c; public static void main(String[] args){ BlockingQueue q = new LinkedBlockingQueue(); p = new Producer(q); c = new Consumer(q); Thread t = new Thread(p); t.start(); new Thread(c).start(); while ...

Why is locking such a mess in PHP?

A SO user asked a question to which the answer effectively was "use a locking mechanism". While researching my answer, I discovered that there seems to be no simple, inter-process-reliable locking mechanism in PHP. flock() has a big fat warning: On some operating systems flock() is implemented at the process level. When using a mult...

MySQL InnoDB lock question

Hi All: I have a question about MySQL InnoDB. For example: I have the following table created: mysql>CREATE TABLE IF NOT EXISTS `SeqNum` ( `id` varchar(10) NOT NULL, `seq_num` BIGINT(30) default 0, PRIMARY KEY(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Query OK, 0 rows affected (0.00 sec) mysql>INSERT IG...

How to be notified when orientation would have changed, after using setRequestedOrientation()?

My Activity locks its orientation by using setRequestedOrientation(). However, once this is set to something other than ActivityInfo.SCREEN_ORIENTATION_SENSOR, onConfigurationChange() is no longer called (since it is not changing anymore) when the user rotates their device. Is there a way, after the orientation is set with setRequested...

is locking necessary for Dictionary lookup?

lock(dictionaryX) { dictionaryX.TryGetValue(key, out value); } is locking necessary while doing lookups to a Dictionary ? THe program is multithreaded, and while adding key/value to dict. dict is being locked. ...

How to abort a active download of a package in Ubuntu?

I was downloading a package from a terminal. Actually i want to install some package 'A'. But,by mistake installing some other package 'B'. So, i wanted to stop the download of that package 'B' and start downloading 'A'. But, i couldnt able to do that. I reset my network connnection. I could stop downloading the package B. But, the admin...

Does scala affect AspectJ/Spring AOP at all? I'm having a thread locking problem when running tests when an @Configurable is being called

I have a strange problem where when I run my tests using maven, it locks whenever a test method calls into an object with an annotation @Configurable. I can run the tests fine in IDEA using the AspectJ Weaver plugin (remarkably), but I cannot do it with maven (whether I execute them in IDEA or just in a terminal). Even weirder, if I pre...

Lock() in a static method

I have a multi threaded application that writes to a settings xml file using a static method. I want to avoid that the file is being updated twice at the same time (causing accesss/write exception). How do I do that? This doesn't work: namespace Program { public class Settings { private static void SetSettingsValue (st...

I need help deciding if I should use cflock or not

I would like to know if locking my table is necessary in this situation (I'm using Coldfusion and MySQL): I have a table called wishlists(memberId, gameId, rank, updateAt) where members store games in a personal list. wishlists has a man-to-many with a members table, and many-to-many with a games table. Many members have many games sto...