I have a legacy WinForms Mdi App in VB.Net 2.0 which I am adding functionality to. One of the additions is a warning which needs to be raised when the current time nears a specified value (a deadline). My intention is to check the time once an hour until there is less than an hour until the deadline, then display warnings at specified in...
I'm writing a Windows Forms Application in C#.NET
On startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising.
Once the main application has finished initialising, the main form of the application is displayed, and the splash scre...
I have a .NET application that processes around 300,000 records in a batch import, and it takes a few seconds per record so I would like to parallelize this. In the following code, what's the difference between ProcessWithAnsycDelegates() and ProcessWithThreadPool()?
public class ResultNotification
{ public EventHandler event Success;
...
Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML.
Here is an example of synchronized part from the method that restores an object:
public T restore(String from) throws Exception {
// variables declaration
synchronized (from) {
try {
de...
I'm a kinda newbie developer with a few years under my belt. Recently I interviewed at a game company and was asked "have you done any multi-threading?" I told them about having a C# app with a few Threads... and then I said a bit about transactions and locking etc in Sql. The interviewer politely told me that this was too high-level ...
We have some problems at our production code, my main problem is that we have some process that growing too much, as I think connections that someone forget to close. or maybe a communication error that causes them to be orphans.
I am looking for a good tool to explore those process (also threads).
I already know the Process explorer, ...
In C# there is a method SetApartmentState in the class Thread.
How do I do the same thing in C++?
...
I am doing a BHO (extension for IE) that receives events on other thread. When I access the DOM from that other thread, IE crashes. Is it possible to make the DOM accessed from the same thread as the main BHO thread so that it does not crash?
It seems like a general COM multithreading problem, which I don't understand much.
...
Are there any tools that can help find race conditions when testing multi-threaded .net code? I'm looking for something with similar capabilities to IBM's ConTest tool for Java.
...
What is the technical difference between a process and a thread? I get the feeling a word like 'process' is over used and there is also hardware and software threads. How about light-weight processes in languages like Erlang? Is there a definitive reason to use one term over the other?
...
I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file.
How to implement/share lock that supports single writers and multiple readers? If somebody reads, nobody can write, but all still can read. If somebody writes, nobody can read/write.
...
I have a thread running in the background that is reading events from an input device in a blocking fashion, now when I exit the application I want to clean up the thread properly, but I can't just run a pthread_join() because the thread would never exit due to the blocking IO.
How do I properly solve that situation? Should I send a pth...
I'm just wondering if the same thread is used for each session, or if its dangerous to count on a particular thread between requests. What I'm getting at, is can I use thread static storage?
...
I would like to implement a producer/consumer scenario that obeys interfaces that are roughly:
class Consumer {
private:
vector<char> read(size_t n) {
// If the internal buffer has `n` elements, then dequeue them
// Otherwise wait for more data and try again
}
public:
void run() {
read(10);
re...
Hi, Java has the thread dump which is triggered by a signal 3 sent to the process (e.g. "kill -3 PID"). The equivalent I've found for .NET is to use ADPlus (http://support.microsoft.com/kb/286350). This basically attaches a debugger, takes a mini dump, and executes a few commands. I find .NET's approach to be a very brute force, cludgy a...
I've done some research and I can't really find a preferred way to do updating of form controls from a worker thread in C#. I know about the BackgroundWorker component, but what is the best way to do it without using the BackgroundWorker component?
...
I was looking at the source code of java.uti.concurrent.locks.AbstractQueuedSynchronizer and the acquire() method looks something like this -
public final void acquire(int arg) {
if (!tryAcquire(arg) &&
acquireQueued(addWaiter(Node.EXCLUSIVE), arg))
Thread.currentThread().interrupt();
}
Why does it interrupt the t...
I came across the function InterlockedExchange and was wondering when I should use this function. In my opinion, setting a 32 Bit value on an x86 processor should always be atomic?
In the case where I want to use the function, the new value does not depend on the old value (it is not an increment operation).
Could you provide an example...
can anyone please tell me what is the return value of WaitForObject() function .
I do not mean the type of return value (int ) .
What does it return if the event is signalled and what does it return if the event is not signalled .
Thanks
...
Let's have the following class definition:
CThread::CThread ()
{
this->hThread = NULL;
this->hThreadId = 0;
this->hMainThread = ::GetCurrentThread ();
this->hMainThreadId = ::GetCurrentThreadId ();
this->Timeout = 2000; //milliseconds
}
CThread::~CThread ()
{
//waiting for the thread to terminate
if (...