We've been dealing with a problem with our event gateways since we upgraded from ColdFusion 8 Enterprise to ColdFusion 9 Enterprise.
We have an event gateway setup to establish a connection to a third party. They went us updates at least every 10 seconds and sometimes many times a second.
We have a Java class configured as the Event ...
For fun I am replacing the mysqli extension in my app with PDO.
Once in awhile I need to use transactions + table locking.
In these situations, according to the mysql manual, the syntax needs to be a bit different. Instead of calling START TRANSACTION, you do it like so...
SET autocommit=0;
LOCK TABLES t1 WRITE, t2 READ, ...;
... do ...
I'm trying to find a way to provide exclusive access to a resource, while at the same time providing information about the state of the lock (_isWorking) for other classes to read.
Here's what I have come up with so far :
private int _isWorking = 0;
public bool IsWorking
{
get { return Interlocked.CompareExchange(r...
I am trying to understand a paper on concurrent B-tree, in which the author mentioned latch vs lock, and how latches do not need a "Lock Manager". I have been trying to figure out what are differences between those two for two days.
Google resulting in:
"locks assure logical consistency of data. They are implemented via a lock table, ...
I'm currently dealing with some old DirectX code that looks (quite often at very different places) something like this:
LPDIRECT3DVERTEXBUFFER9 buffer;
//create the vertex buffer correctly here ...
buffer->Lock(...);
//loop through the buffer to check something
for(...) {
if(checkPositive) return true;
//some other code still in...
Hi, I have a problem regarding multithreading and inserting an item to an Dictionary. The following situation is what I am encoutering when insertingen subjects with duplicate id's:
private static readonly Timer bufferChecker;
private static readonly List<SubjectStartRulePair> inBuffer;
private static readonly IDictionary<Gu...
Is there a way to lock a Mysql table only for write, so that another script can still make a SELECT query?
I'm using this code to write to a table (executes almost every second):
mysql_query("LOCK TABLES table WRITE;");
mysql_query("insert into...
mysql_query("UNLOCK TABLES;");
and this to select (this script just freezes, probably b...
Hi
I have a password page and when someone enters an incorrect password I want to simply foil a brute force attack by having
bool isGoodPassword = (password == expected_password);
lock (this)
{
if (!isGoodPassword)
Thread.Sleep(2000);
}
I would expect that this would allow all correct passwords without stalling, but ...
Consider the scenario below:
The application is multi-threaded and it has one static ArrayList used globally.
The application has one thread that reconstruct the ArrayList entirely from data read from database from time to time.
The application has N threads reading from this global ArrayList in parallel.
What is the best approach to...
Database has table X and tables An, Bn, Cn, Dn that inherits from X.
Process 1 queries periodically data from X.
Process 2 updates data in child tables. For example, to update tables An and Bn it creates new tables Am and Bm, loads data into them, locks in access exclusive An, Bn, drops An and Bn and alters Am and Bm to inherit X.
The...
I've got a List collection and I want to iterate over it in a multi threaded app. I need to protect it every time I iterate it since it could be changed and I don't want "collection was modified" exceptions when I do a foreach.
What is the correct way to do this?
Use lock every time I access or loop. I'm rather terrified of deadlock...
I'm currently using Retlang for message-based multithreading in .NET, which is a great library. I've got no explicit locks anymore, every thread is doing its own business, managing its part of the application and communicating with other threads via messages.
I now have to implement a feature of my application that could also have its o...
For last 48 hours, I have been trying to understand Multithreading and Socket Programming. I tried to implement socket programming and had success when not using multithreading. I am new to both of the topics and have raised 2-3 question on stack itself needing help on the same.
After googling a lot I found an article that explains So...
I am running four threads that gets and sets the same property.
When i uses breakpoint then it gives me result as expected but when i runs it directly it gives me last updated result.
Here is my code
int Port { get; set; }
Thread[] tMain= new Thread[4];
public void btnListen_Click(object sender, EventArgs e)
{
for...
I use BrB to share a datasource for various worker processes in Ruby 1.9 that I fork with Process#fork like the following:
Thread.abort_on_exception = true
fork do
puts "Initializing data source process... (PID: #{Process.pid})"
data = DataSource.new(files)
BrB::Service.start_service(:object => data, :verbose => false, :host => ...
Hello all
I am having a problem with version control in subversion. I checked out a working copy from respository and got locks on all of its files. Then, without releasing the locks I have deleted the folder from disk.
I can't delete the folder from repository, since its got a lock
If the I and try to release the locks recursively, i...
Is it good practice to close and dispose of resources before displaying error messages?
If you are catching errors and you display an error message in the same scope as resources such as database and file objects, then shouldn't these resources be closed and disposed of before the error message is displayed?
If you are waiting for th...
I want to lock one record in a table.
The record is specified as "the next that has ID greater than..."
CREATE TABLE test (id number);
SELECT id
FROM (SELECT id
FROM test
WHERE id > 10
ORDER BY id)
WHERE ROWNUM = 1
FOR UPDATE;
This seems intuitive and easy. But it is not. Any ideas?
P.S.
I do need the existing qu...
I have the need to open a file, read-lock it, then attempt to get a write lock but keep the read lock if it fails.
This works great in POSIX using fcntl locking.
In Windows I can use LockFileEx to get file locks. I can get both read and write locks (shared and exclusive).
However, it seems that in Windows I must take the exclusive wri...
I want to be able to detect the phone lock event. When my app is running, if I press the red button (call end button/power button), the phone gets locked and the screen goes blank. I want to be able to detect this event, is it possible?
Thanks
Chris
...