Today I had to fix some older VB.Net 1.0 code which is using threads. The problem was with updating UI elements from the worker thread instead of the UI-thread. It took me some time to find out that I can use assertions with InvokeRequired to find the problem.
Besides the above mentioned concurrent modification problem, there are deadlo...
I need a way to CreateRemoteThread in x64 windows into both 64 and 32 bit processes. I've worked out how to find instruction set of target process, how to allocate memory in the target process for the assembly sled, and I've almost worked out what to do about address space randomization.
I don't know how to actually start the thread on ...
I have an winform application that creates 5 threads to connect to and retrieve information from a database on a very slow connection (90 seconds for some queries).Each thread has it's own instance of a class for performing sql queries. When the queried data has been retrieved the main thread is notified by an event fired from the class ...
Suppose I have the following code:
public class SomeClass()
{
private readonly object _lock = new object();
public void SomeMethodA()
{
lock (_lock)
{
SomeHelperMethod();
//do something that requires lock on _lock
}
}
public void SomeMethodB()
{
lock (_lock)
{
SomeHel...
In Release It!, Michael Nygard reasons that many catastrophic system failures are often caused by a chain of things going wrong. For example, two threads deadlock. There's now two less threads in the thread pool, so load increases on the other threads increasing their likelihood of deadlocks. Suddenly, the server does not respond at all,...
This seems like perhaps a naive question, but I got into a discussion with a co-worker where I argued that there is no real need for a cache to be thread-safe/synchronized as I would assume that it does not matter who is putting in a value, as the value for a given key should be "constant" (in that it is coming from the same source ultim...
I'm trying to implement a simple class like this:
public static void main(String args[])
{
try
{
myClass test = new Thread(new myClass(stuff));
test.start();
test.join();
}
catch (Throwable t) { }
}
When I try to include a print() method in myClass and use it, I get a "cannot find symbol" in class java.l...
I just stumbled on Protothreads. They seems superior to native threads since context switch are explicit.
My question is. Makes this multi-threaded programming an easy task again?
(I think so. But have I missed something?)
...
Hi ,
i have got CopyFile and Directory project.But when i started to copy Gui is freezing.I cant do anything file copying.So i found my solution at BackgroundWorker Component.But i got a problem with this component too.There are 3 radio button and command button.When i clicked command button its checking if radiobutton1 checked or else r...
This is a follow up to this question, where I didn't get any input on this point. Here the brief question:
Is it possible to detect and debug problems coming from multi-threaded code?
Often we have to tell our customers: "We can't reproduce the problem here, so we can't fix it. Please tell us the steps to reproduce the problem, then we...
I'm getting an exception in an OnTimer event handler (TTimer) that when executed increments an integer variable in the parent form. The timers need to be able to access an incremented integer used as an id.
My first question is: How can I tell in Delphi 2007 which code is running in which thread? Is there a way in debug mode to inspec...
Been doing mostly Java and smattering of .NET for last five years and haven't written any significant C or C++ during that time. So have been away from that scene for a while.
If I want to write a C or C++ program today that does some multi-threading and is source code portable across Windows, Mac OS X, and Linux/Unix - is PThread a goo...
while learning some basic programming with python, i found web.py. i
got stuck with a stupid problem:
i wrote a simple console app with a main loop that proccesses items
from a queue in seperate threads. my goal is to use web.py to add
items to my queue and report status of the queue via web request. i
got this running as a module but c...
Hi everyone, what would happen if I spin off a thread to execute a long-running process right before the ASP.NET page lifecycle completes? Will the ASP.NET runtime kill the thread? Can this lead to undefined behaviour?
Here's a sample of the code, which spins the background thread in the Page_Load event. Is this a safe thing to do?
pro...
I have a class that I wish to test via SimpleXMLRPCServer in python. The way I have my unit test set up is that I create a new thread, and start SimpleXMLRPCServer in that. Then I run all the test, and finally shut down.
This is my ServerThread:
class ServerThread(Thread):
running = True
def run(self):
self.server = #Cr...
From a logical point of view an application may need dozens or hundreds of threads, some of which will we sleeping most of the time, but a very few will be always running concurrently. The question is: Does it make any sense to spawn more concurrent threads than processors there are in a system, or it is a waste?
I've seen some server a...
Is it at all possible in the middle of a function execution to set a pointer to the current stack (to be picked up later) and then release the current thread (without unwinding the call stack) and give it back to the thread pool? And then, have another thread pick up where that thread left off? I know it would mean that someone calling...
I am using this code where I am invoking the run method of a List of classes that I loaded dynamically from dlls:
for (int i = 0; i < robotList.Count; i++)
{
Type t = robotList[i]; //robotList is a List<Type>
object o = Activator.CreateInstance(t);
t.InvokeMember("run", BindingFlags.Default | BindingFlags.InvokeMethod, null,...
I was just reading up on ROR (haven't dived into it yet), and I hear that it isn't thread safe. Obviously, this doesn't mean that more than one person can't access your site at one time, so what exactly does it mean? Where do threads come into play in ROR? Do they just mean the request handling?
...
I'm working on a custom mark-release style memory allocator for the D programming language that works by allocating from thread-local regions. It seems that the thread local storage bottleneck is causing a huge (~50%) slowdown in allocating memory from these regions compared to an otherwise identical single threaded version of the code,...