multithreading

How can I see my applications threads while debugging in Visual Studio?

I would like to see the threads currently active in my application while debugging it. How can I do this using Visual Studio? ...

WinForms: Implementation question for having my UI run independently of my BLL layer?

I am trying to do a Windows Forms application in an MVP style and - not having done much with threading before - am getting all confused. My UI is a set of very simple forms. Each of the forms implements an interface and contains a reference to a mediator class which lives in the Business Logic Layer and vice versa. So as simplified di...

GPU-based video cards to accelerate your program calculations, How?

I read in this article that a company has created a software capable of using multiple GPU-based video cards in parallel to process hundreds of billions fixed-point calculations per second. The program seems to run in Windows. Is it possible from Windows to assign a thread to a GPU? Do they create their own driver and then interact wit...

STAThread and multithreading

From the MSDN article on STAThread: Indicates that the COM threading model for an application is single-threaded apartment (STA). (For reference, that's the entire article.) Single-threaded apartment... OK, that went over my head. Also, I read somewhere that unless your application uses COM interop, this attribute actually does no...

Thread-safe atomic operations in gcc

In a program I work on, I have a lot of code as follows: pthread_mutex_lock( &frame->mutex ); frame->variable = variable; pthread_mutex_unlock( &frame->mutex ); This is clearly a waste of CPU cycles if the middle instruction can just be replaced with an atomic store. I know that gcc is quite capable of this, but I haven't been able t...

C++: Multithreading and refcounted object

I'm currently trying to pass a mono threaded program to multithread. This software do heavy usage of "refCounted" objects, which lead to some issues in multithread. I'm looking for some design pattern or something that might solve my problem. The main problem is object deletion between thread, normally deletion only decrement the refere...

Which parallel programming APIs do you use?

Trying to get a grip on how people are actually writing parallel code currently, considering the immense importance of multicore and multiprocessing hardware these days. To me, it looks like the dominant paradigm is pthreads (POSIX threads), which is native on Linux and available on Windows. HPC people tend to use OpenMP or MPI, but th...

Should I use threading and recursion together?

I have been tinkering with BSP trees for a while now and am also playing with threads. When adding a triangle to a BSP tree, an opportunity arises to create a new thread for the purposes of processing data in parallel. insert(triangle, bspnode) { .... else if(triangle spans bspnode) { (frontpiece, backpiece) = plane_split(tr...

How to open a form in a thread and force it to stay open

I am still having problems with figuring out how to create winforms in a separate UI thread that I discussed here. In trying to figure this out I wrote the following simple test program. I simply want it to open a form on a separate thread named "UI thread" and keep the thread running as long as the form is open while allowing the user...

NSThread and UIViewController interaction

If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this... (a) not working -(void)myCallbackInThread { // move on... UIApplication* app = [UIApplication sharedApplication]; [app changeView]; } then I find that the view appears, but does not respond to user i...

How do I use an arbitrary string as a lock in C++?

Let's say I have a multithreaded C++ program that handles requests in the form of a function call to handleRequest(string key). Each call to handleRequest occurs in a separate thread, and there are an arbitrarily large number of possible values for key. I want the following behavior: Simultaneous calls to handleRequest(key) are serial...

C# .Net exe doesn't close when PC is restarted, keeping the machine from restarting

We have a SmartClient built in C# that stubornly remains open when the PC its running on is being restarted. This halts the restart process unless the user first closes the SmartClient or there is some other manual intervention. This is causing problems when the infrastructure team remotely installs new software that requires a machine...

Why do thread functions need to be declared as '__cdecl'?

Sample code that shows how to create threads using MFC declares the thread function as both static and __cdecl. Why is the latter required? Boost threads don't bother with this convention, so is it just an anachronism? For example (MFC): static __cdecl UINT MyFunc(LPVOID pParam) { ... } CWinThread* pThread = AfxBeginThread(MyFunc, ....

Silverlight: Empty Storyboard vs BackgroundWorker

Which one performs better to run a game main loop? ...

Making locking easier in MTAs

In multi-threaded code, when an instance may be read or written by multiple threads, they need to be locked on to perform these operations safely. To avoid the repetition of creating an object to lock on and writing a bunch of lock statements through code, I've created a generic class to handle the locking. Am I missing anything, conc...

How can I implement java-like synchronization (monitors) using the Win32 API?

Each Java object (and its class) has an associated monitor. In pthread terms a Java monitor is equivalent to the combination of a reentrant mutex and a condition variable. For locking, the Win32 API provides Mutex objects (which are reentrant but heavyweight) and Critical Sections (which are non-reentrant but lightweight). It also provi...

C++ thread/process identifier

Is there a portable way of getting thread and/or process identifier (string, int, ...) with C++? ...

What are best practices for using thread local storage in .NET?

I have a requirement in my application that I think can be met by using thread local storage, but I'm wondering if it's one of those things that's best to avoid. I have read a few articles on the subject: http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=58 http://msdn.microsoft.com/en-us/library/system.threadstaticatt...

Multi-Threaded Deep Copies

What's the best way to perform a deep copy in the constructor of an object that is part of multi-threaded C++ code? ...

Process and Thread

What is the data that Process and Thread will not share ? An advance thanks goes to everybody who provide their time ...