These two may look like they have no correlation but bear with me!
In a previous version of the software I develop/maintain there was a web app sitting on top of a web service. There was a scheduled task that run every hour called one of the web methods to carry out some tasks.
In the new architecture we now have a web application pr...
e.g. in Winforms I'd write...
// on UI Thread
BackgroundWorker workerThread = new BackgroundWorker();
workerThread.DoWork += new DoWorkEventHandler(LoadChildren);
workerThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnLoadChildrenCompleted);
while (workerThread.IsBusy)
{
Application.DoEvents();...
Is there any documentation on cross thread communication in Delphi? How can I send message to the thread that doesn't have a window?
...
We know that a single application instance can use multiple cores and even multiple physical processors. With cloud and cluster computing, or other special scenario, I don't know if a single stance can run across multiple computers, or across multiple OS instances.
This is important for me because, besides being considered as bad progra...
I am primarily a Java developer, and I've been reading a lot of in-depth work on threads and concurrency. Many very smart people (Doug Lea, Brian Goetz, etc) have authored books on these topics and made contributions to new concurrency libraries for Java.
As I start to learn more about Python, Ruby, and other languages, I'm wondering: ...
I am running creating an iPhone application which performs a costly operation and I wanted to create an activityIndicator to let the user know the application has not frozen.
The operation is performed entirely in one event call... so there is no chance for the UI framework to receive control to actually display and animate this indicat...
My situation is roughly similar to this guy except that I don't need change notifications right now
I have a WPF App displaying a hierarchy. The children for each node are retrieved using a LinqToSql query. The app works perfectly when there is one thread.
Now I'd like to make things a bit faster.. by loading children asynchronously. F...
I'm looking for a piece of code which behaves a bit like a singleton but isn't (because singleton's are bad :) What I'm looking for must meet these goals:
Thread safe
Simple (Understand & use, i.e. few lines of code. Library calls are OK)
Fast
Not a singleton; for tests, it must be possible to overwrite the value (and reset it after th...
Hello! This is a question about Python native c file _lsprof.
How does _lsprof.profile() profiler counts total time spent on a function f in a multi-threaded program if the execution of f is interrupted by another thread?
For example:
def f():
linef1
linef2
linef3
def g():
lineg1
lineg2
And at the execution we have, f...
Put the following into a file hello.py (and easy_install paramiko if you haven't got it):
hostname,username,password='fill','these','in'
import paramiko
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(hostname=hostname, username=username, password=password)
i,o,e = c.exec_command('ls /')
print(...
Inspired by this question: http://stackoverflow.com/questions/443423/in-complexity-analysis-why-is-considered-to-be-2-operations
Take the following psuedo code:
class test
{
int _counter;
void Increment()
{
_counter++;
}
}
Would this be considered thread safe on an x86 architechure? Further more are the Inc / Dec as...
In VS2008, C#, I've created a unit test (VS unit test) that calls some code which in turn calls Log4Net and logs some information. This works.
If I create a thread in the unit test to call the same code I'm getting "Failed to parse config file" exception from Log4Net.
Any ideas why it would not be able to parse the config file from the...
The following C# class is used in a multithreaded enviroment. I removed very much of the actual code. The problem occurs when calling MethodA and MethodB almost simultaneously. The order of the lock in the IsDepleted property doesn't solves the problem. Removing lock(WaitingQueue) from the IsDepleted property solves the deadlock, but thi...
Alright...I've given the site a fair search and have read over many posts about this topic. I found this question: http://stackoverflow.com/questions/435668/code-for-a-simple-thread-pool-in-c especially helpful.
However, as it always seems, what I need varies slightly.
I have looked over the MSDN example and adapted it to my needs some...
In a Windows Form window, multiple events can trigger an asynchronous method. This method downloads a file and caches it. My problem is that I want that method to be executed once. In other words, I want to prevent the file to be downloaded multiple times.
If the method downloading the file is triggered twice, I want the second call to...
I wrote a multi-threaded windows application where thread:
A – is a windows form that handles user interaction and process the data from B.
B – occasionally generates data and passes it two A.
A thread safe queue is used to pass the data from thread B to A. The enqueue and dequeue functions are guarded using a windows critica...
I'm about to tackle what I see as a hard problem, I think. I need to multi-thread a pipeline of producers and consumers.
So I want to start small. What are some practice problems, in varying levels of difficulty, that would be good for multi-threading practice? (And not contrived, impractical examples you see in books not dedicated t...
I want to know how I can run a method in a separate thread? Class & Method references. Thanks.
...
We have a website running .NET 2.0 and have started using the ASP.Net HttpRuntime.Cache to store the results of frequent data lookups to cut down our database access.
Snippet:
lock (locker)
{
if (HttpRuntime.Cache[cacheKey] == null)
{
HttpRuntime.Cache.Insert(cacheKey, GetSomeDataToCache(), null, DateTime.Today.AddDa...
I have threaded code where each thread needs to write to the same file. To prevent concurrency issues, I am using a Lock object.
My question is whether I am using the Lock correctly. If I set the lock from within each thread, is that lock global or only specific to that specific thread?
Basically, should I create a Lock first and pas...