multithreading

How to test WPF components in VS08 unit testing framework?

I have created some tests in my WPF application. Right now I am working on testing single components, for example images and text blocks. If I run a single test in my unit tests, they all pass without a hitch. The problem occurs when I try run all the tests, I get the following errors in the tests that create and modify WPF components: ...

Interleaved parallel file read slower than sequential read?

I have implemented a small IO class, which can read from multiple and same files on different disks (e.g two hard disks containing the same file). In sequential case, both disks read 60MB/s in average over the file, but when I do an interleaved (e.g. 4k disk 1, 4k disk 2 then combine), the effective read speed is reduced to 40MB/s instea...

How to detect when main thread terminates?

What I need to know: I would like to detect when a the main thread (process?) terminates so that I can ensure certain actions are performed before it is terminated. What I have found myself: I found the events AppDomain.DomainUnload and AppDomain.ProcessExit. AppDomain.DomainUnload seems to work with non-applications like MbUnit. App...

Resuming C# threads

Possible duplicate question: http://stackoverflow.com/questions/142826/is-there-a-way-to-indefinitely-pause-a-thread In my code i do the below Thread mainThread //... mainThread.Resume(); void StartThread() { while (!wantQuit) { db.runEmail(); mainThread.Suspend(); } } Then i get the exception below be...

C#'s lock() in Managed C++

Does managed C++ have an equivalent to C#'s lock() and VB's SyncLock? If so, how do I use it? ...

simple thread work in c++

Hi I am creating a simple C++ program to ask user for fahrenheit in main thread and then convert this value to Celsius in another thread. But i continue to get one error . This error keeps visual studio 2008\projects\cs1\cs1\cs1.cpp(16) : error C2143: syntax error : missing ';' before '=' This problem sometimes disappears but inste...

Can I use thread.stop () in Java if I really need it?

I need to use deprecated stop () because I need to run Runnable classes which were developed by other programmers and I can't use while (isRunning == true) inside method run. The question is: Is it safety enough to use method stop ()? Theads don't work with any resources (like files, DB, or Internet connections). But I want to be sure t...

C# equivalent of Java's Thread.setDefaultUncaughtExceptionHandler()?

Is there a C# equivalent of Java's Thread.setDefaultUncaughtExceptionHandler()? ...

Console and Windows Forms in C#

Ok I'm creating an application with a plugin architecture and the application would be able to run without a GUI in other words the GUI is really optional... and if the user decides to use the GUI the console is just hidden. I can create the form in the console by calling one of the plugins method, but as soon the Window is created the ...

How to detect when application terminates?

This is a follow up to my initial question and I would like to present my findings and ask for corrections, ideas and insights. My findings (or rather interpretations) come from people's answers to my previous question, reading MSDN .NET 3.5 documentation and debugging .NET 3.5 code. I hope this will be of value to someone who was wonder...

Analysing Thread behaviour in Java

I need to draw a graph of write accesses of two concurrently running threads. What is the best way to write a timestamp value pair of these accesses to an array, without interfering with the threads themselves? The queue that is being written to looks like this: import java.util.concurrent.atomic.AtomicInteger; class IQueue<T> { A...

how to use CreateThread for functions which are class members

how to use CreateThread() to create threads of functions which are class members. ...

How to execute code in c# service one time per day at the same hour ?

So here's my problem, I need to do a c# service running on a server who's getting file on ftp one time per day at 3am. I think that I can do it with a thread.sleep() or by compare the DateTime.Now with 3am.... Do you have better solution? Thank you very much for your help! ...

Threading using AJAX

When the user clicks on a link to generate report I make an AJAX call which generates a pdf file in the background.Now the files are huge running upto 10mb or more.So it takes some time.In the mean time the user should be able to navigate other links as if nothing has happened.So I need to implement in such a way that the pdf generation ...

C++ Boost Code example of throwing an exception between threads

Can someone please show a simple, but complete example of how one could use Boost exception library to transfer exceptions between thread by modifying the code below? What I'm implementing is a simple multi-threaded Delegate pattern. class DelegeeThread { public: void operator()() { while(true) { // Do some work ...

Is there a way to send data to a BackgroundWorker after it has been started?

I know you can pass arguments through the RunWorkerAsync function call when you first start the backgroundworker, but can you pass it data after its already been started? Or would I need to create my own form of concurrency to handle passing data to it from a different thread? ...

Is a method with no linearization points always not linearizable?

If you can definitely prove that a method has no linearization points, does it necessarily mean that that method is not linearizable? Also, as a sub question, how can you prove that a method has no linearizatioon points? ...

Synchronization issues: everything seems correct, but...

I wrote a multithreaded application for .NET and in a very important portion of code I have the following: public class ContainerClass { private object list_lock; private ArrayList list; private object init_lock = new object(); private ThreadClass thread; public void Start() { lock(init_lock) { i...

multithreaded multiclient programming

hi... i m doing a client - server application.... i want to connect multiple clients with a single server...here each client is connected with the server using three ports..one for -sending an image second- sending the keyboard events third - sending mouse events all these infor...

read/write locking a static var in asp.net

I've got a static variable (abstract data type, not a primitive) in my C# ASP.NET project. It will be read by many threads, concurrently and frequently. I need to write to it very rarely (compared to number of reads). What is the best way of ensuring threadsaftey so that whilst im writing to it, other threads aren't reading partially-...