Is it possible to re-assign the Win + L hotkey to another executable/shortcut?
Use-case - I would like to switch off the monitor of my laptop as soon as it is locked. I know of a executable which can lock and turn off the monitor but I do not want to change the way the system is locked (by running the program explicitly or by some other...
Can someone explain the difference between:
lock (someobject) {}
Using Mutex
Using Semaphore
Using Monitor
Using Other .Net synchronization classes
I just can't figure it out. It seems to me the first two are the same?
...
I have a manager class that produces tasks for a threadpool, and each thread is supposed to do a call back once they are finished.
I use locks to handle variables and fields, and signals to handle interthread communications. What I'm looking for is a way of exiting the current lock() and wait for a signal atomically, something like Sign...
Hello,
I am wondering if I need to lock some code created in the application scope. If I create an object say userDAO.cfc in application scope so its available to all pages. Then if I have a method in that object say getUserInfo(userID) that would be called in different parts of the applications, do I need to lock this method?
Thanks...
Consider the "double-check idiom for lazy initialization of instance fields":
// Item 71 in Effective Java copied from this interview with Bloch.
private volatile FieldType field;
FieldType getField() {
FieldType result = field;
if (result == null) { // First check (no locking)
synchronized(this) {
result = f...
If a "WITH NOLOCK" query hint is used on a View in SQL Server, does it propagate that hint to the view definition itself, even if NOLOCK is NOT used for the raw tables in the View definition? The reason to need this is that sometimes the support staff wants to do huge time-consuming queries but would rather not force this lock on all que...
I have a class which looks something like this:
public class Test {
private static final Object someObject = new Object();
public void doSomething()
{
synchronized (someObject) {
System.out.println(someObject.toString());
}
}
}
Can I consider the object to be synchronized, or is there a problem since it is a static member?
Edi...
Here are two chunks of code that accomplish (what I think is) the same thing.
I basically am trying to learn how to use Java 1.5's concurrency to get away from Thread.sleep(long). The first example uses ReentrantLock, and the second example uses CountDownLatch. The jist of what I am trying to do is put one thread to sleep until a cond...
This problem crops up every now and then at work. Our build machine can have it's files accessed via a normal windows file share. If someone browses a folder remotely on the machine, and leaves the window open overnight, then the build fails (as it has done now). The explorer window left opened points at one of the sub folders in the sou...
this is the standard approach to create locks using file system. For example, visudo uses it:
[ -f ".lock" ] && exit 1
touch .lock
# do something
rm .lock
1) I'm confused, for there's a race condition, yet Linux uses it
2) is there a better way to lock on files from shell?
3) or do I have to use directories instead?
Found solutio...
I'm trying to update a variable in APC, and will be many processes trying to do that.
APC doesn't provide locking functionality, so I'm considering using other mechanisms... what I've found so far is mysql's GET_LOCK(), and php's flock(). Anything else worth considering?
Update: I've found sem_acquire, but it seems to be a blocking loc...
abstract class Foo
{
private List<Object> container;
private bool update;
Foo Foo()
{
container = new List<object>();
update = false;
}
public abstract Bar CreateBar();
public void BeginUpdate()
{
if (!update)
{
Thread update_thread = new Thread(new ThreadStar...
Checkstyle reports this code as "The double-checked locking idiom is broken", but I don't think that my code actually is affected by the problems with double-checked locking.
The code is supposed to create a row in a database if a row with that id doesn't exist. It runs in a multi-threaded environment and I want to avoid the primary-key...
A number of stored procedures I support query remote databases over a WAN. The network occasionally goes down, but the worst that ever happened was the procedures failed and would have to be restarted.
The last couple weeks it's taken a sinister turn. Instead of failing the procedures hang in a wierd locked state. They can't be kille...
This java program I am working on seems to hang on startup, so I tried using jconsole to debug the problem.
As it turns out it is waiting on a call to a method which is declared as -
synchronized void stopQuery()
But here is the crazy part, the lock for the 'synchronized' method is already held by the thread which is blocked for it.
I...
The support of locking will be preferred.
...
The following VBA code works great in Excel 2003, but results in a "stack overflow error" in Excel 2007. The code is required to either unlock or lock certain cells based on a drop-down menu selection. I need to be able to run the code in both Excel 2003 and 2007. Please help.
Private Sub Worksheet_Change(ByVal Target As Range)
If [E2...
Hi !
I've got in an ASP.NET application this process :
Start a connection
Start a transaction
Insert into a table "LoadData" a lot of values with the SqlBulkCopy class with a column that contains a specific LoadId.
Call a stored procedure that :
read the table "LoadData" for the specific LoadId.
For each line does a lot of calculatio...
I need to intercept the console output stream(s) in order to capture it for a log but still pass things through to the original stream so the application works properly. This obviously means storing the original Console.Out TextWriter before changing it with Console.SetOut(new MyTextWriterClass(originalOut)).
I assume the individual op...
Apologies for the long post, but I wonder if I could get some more eyeballs on this before I submit a bug report to Sun.
JVM: 6u11
O/S: Windows XP SP3
Hardware: AMD Athlon 64 X2 4600+ @ 2.41GHz, with 3.25 GB RAM.
I believe I have encountered a fault in the JVM where no thread is given a monitor. In the following thread traces, the mon...