Suppose I have these two tables:
Invoice
-------
iInvoiceID int PK not null
dtCompleted datetime null
InvoiceItem
-----------
iInvoiceItemID int PK not null
iInvoiceID int FK (Invoice.iInvoiceID) not null
dtCompleted datetime null
Each InvoiceItem might be fulfilled by a different process (executable) that runs on a different machine...
I'm working on a protected Excel spreadsheet and ran into a problem with cells that I've programmatically locked that are still selectable. I can't click on them directly to select them, but if I select the cell to the lower right of a locked cell and then shift-click the one to the upper left, all 9 cells (including the 'locked' one) a...
Will the _otherThing field below be protected by the locks?
class ThreadSafeThing
{
private readonly object _sync = new object();
private SomeOtherThing _otherThing;
public SomeOtherThing OtherThing { get { lock(_sync) return _otherThing; } }
public void UpdateOtherThing(SomeOtherThing otherThing)
{
lock(_...
I have the following code:
var items = new List<string> {"1", "2", "3"}; // 200 items
foreach(var item in items) {
ThreadPool.QueueUserWorkItem((DoWork), item);
}
private void DoWork(object obj)
{
lock(this)
{
using(var sw = File.AppendText(@"C:\somepath.txt")
{
sw.WriteLine(obj);
}
}
}
Because of the thread...
Hi there,
Is there anyway to see a list of the current locks in Coldfusion (particularly locks on files or directories).
Through a non documented call is fine as this is more for debugging some errors we're getting on our server.
Thanks,
Tom
...
Hi,
I am trying to lock a "boxed" object in a c# app, is this not possible?
class t
{
System.Object t_x = new object();
public t(int p)
{
t_x = p;
}
public void w()
{
lock (t_x)
{
for (int i = 0; i < 4; i++)
{
...
How to properly synchronize this? At the moment it is possible thatSetData is called after e.WaitOne() has completed so d could be already set to another value. I tried to insert locks but it resulted into a deadlock.
AutoResetEvent e = new AutoResetEvent(false);
public SetData(MyData d)
{
this.d=d;
e.Set(); // notify that ne...
My application running on a Windows server makes use of a Jet/Access database. For some reasons around every two weeks that database file gets locked by the System process (PID 4, seems to be fixed)
After some googling I found some other users having their files locked by that special process, but different files (of course).
What's t...
I'm working on some Python code modeled on Apache's MPM prefork server. I am more an applications programmer than a network programmer and it's been 10 years since I read Stevens, so I'm trying to get up to speed in understanding the code.
I found a short description of how Apache's prefork code works, by Sander Temme.
The parent pr...
Hi,
I'm currently in the process of detaching a development database on the production server. Since this is a production server I don't want to restart the sql service. That is the worst case scenario.
Obviously I tried detaching it through SSMS. Told me there was an active connection and I disconnected it. When detaching the second t...
I have a threaded console application that is working fine, but it's architecture needs to be improved, and I'd like some feedback.
Currently, the program loads up a list of data, and segments that data into partitions (one chunk for each thread). The program then initializes a new thread using the ThreadPool, and passes it ONE segment...
Hi
I am trying to create a timer job in WSS 3.0. My timer job would create the object of SPsite then SPWeb and then SPDocumentLibrary (or possibly picture library)using their GUIDs stored in any xml or database.After that it would take the back up of documents in the document library in some third party application and then delete thos...
I am always get confused . Would someone example what Reentrant means in different
contexts? And why would you want to use reentrant vs. non-reentrant.
Say pthread (posix) locking primitives, are the re-entrant or not? What pitfalls should be avoided when using them
Is mutex re-entrant?
Thanks
...
On the file_put_contents() documentation, it says the following:
FILE_APPEND:
Mutually exclusive with LOCK_EX since
appends are atomic and thus there is
no reason to lock.
LOCK_EX:
Mutually exclusive with FILE_APPEND.
Yet, a couple of lines bellow I see the following code:
<?php
$file = 'people.txt';
// The new person t...
Our website has a configuration page such as "config.aspx", when the page initializing will load some infomations from a configuration file. To cache the loaded informations we provided a factory class and we call a public method of the factory to get the configuration instance when the page loaded. But sometimes when the Applciation Poo...
I'm doing a bash script that interacts with a MySQL datatabase using the mysql command line programme. I want to use table locks in my SQL. Can I do this?
mysql -e "LOCK TABLES mytable"
# do some bash stuff
mysql -u "UNLOCK TABLES"
The reason I ask, is because table locks are only kept for the session, so wouldn't the lock be released...
I have two threads, a producer thread that places objects into a generic List collection and a consumer thread that pulls those objects out of the same generic List. I've got the reads and writes to the collection properly synchronized using the lock keyword, and everything is working fine.
What I want to know is if it is ok to access ...
I've got a queue resource that is shared across multiple producers and multiple consumers. All are independent processes; no one process "owns" the queue.
By nature of the implementation access to the queue must be controlled and only one process must be allowed to push or pop at any given moment.
I figured using a POSIX named semapho...
usecase example
I have a servlet that is receiving login requests.
If a login is currently in process OR the user is already logged in, the servlet should abort and inform the caller.
current design
Taking inspiration from database sharding, I plan to use the first character of each userid as a synchronization key.
void login( Stri...
I've read articles like these:
http://www.codinghorror.com/blog/archives/001166.html
http://www.databasejournal.com/features/mssql/article.php/3566746/Controlling-Transactions-and-Locks-Part-5-SQL-2005-Snapshots.htm
And from what I understand, SQL Server has a very pessimistic locking strategy. And to improve performance, I should chang...