multithreading

Any advice on how to speed up this in Android?

In one Activity, I am doing this: Every minute, I update the GPS location to the cloud. Then, after the location is updated, I download a list of 10 people and their icons...and update them in the list. (each icon is 80x80 and about 2Kb) This is done every minute, over and over. My problem is: It seems to be a little slow? Sometime...

Why are my message be processed out of order over a single WCF TCP channel (with ConcurrencyMode.Reentrant)?

The client sends a lot of messages to the server from a single thread, over a single WCF channel. The client sends the message with BeginMyMethod(x, b) as it does not wish to block while they get processed. We have reliable messaging turned on, as we don’t wish to lose any messages, or have them get out of order. However the messag...

Multithreaded C program; how to kill processes spawned by threads?

Situation: I am writing a program in C that maintains a number of threads. Once a thread ends, a new one is created. Each thread forks - the child runs a process via exec() and the parent waits for it to finish. In addition, there is a signal handler thread that waits for signals. If SIGINT is detected then it tells the main threa...

Is there a .net thread shaker for I can use from unit tests?

I am writing a unit test for some thread locking logic, so as to make the test more likely to fail quickly; I wish to have all the threads switch between each other very often and at random times. I know this will not prove we don’t have any bugs, but at least it should make the bugs show up more often. Thanks to everyone saying "don...

C# Waiting for multiple threads to finish

I have a windows forms app that I am checking all the serial ports to see if a particular device is connected. This is how I spin off each thread. The below code is already spun off the main gui thread. foreach (cpsComms.cpsSerial ser in availPorts) { Thread t = new Thread(new ParameterizedThreadStart(lookForValid...

.NET Threading & Locks & Waiting

I am attempting to make my GUI thread remain responsive-ish during long running operations. These operations must be synchronous as they are usually operations which are required to finish before the requested operation can complete. I was attempting to do this with a background worker, monitors and a lock object. Essentially I want to...

Threaded rendering with NSOpenGLView

Hello, I have an old AGL-based OpenGL windowing system that I am updating to use NSOpenGLView. The engine using it needs to run in its own loop in a separate thread and I am having trouble getting that to work. With AGL, I created the context in the loop thread, so there was no issue, but I'm a little bit confused about the way to do th...

Thread Deadlock

I have 2 threads. One thread prints odd numbers and the second thread prints even numbers. Now, I have to execute the threads alternatively so that i can output 1,2,3,4,5,6,..... I have written a program for this and this is resulting in a deadlock. Can someone explain what is the problem with the code and how to rectify it? class Boo...

What resources/references are available for multithreaded programming in Python?

I'm evaluating the use of Python for a new project and ran through some basic tutorials but am looking for some recommendations and resources for multithreaded development in Python? How does it compare to other languages? ...

one quick question about stack of thread and process

What's the policy for a thread to have a stack and a process to have a stack. If we have 10 process, how many stacks we have, 10? If we have 10 threads under one process, how many stacks we have, 1? All the thread shared the same stack? Thanks! ...

mod_passenger, threads and singleton classes

I have a question regarding mod_passenger and Singleton classes (rails 2.3.5 and ruby 1.9.1). In my aplication, I have a Singleton class that implements a thread pool (thread safe). Also there is controller to manage all the threads (kill and start them). This controller uses the previous singleton class to do the actions over the thre...

Do VS2010's new "thread monitor/visualizer" features support CLR 2.0?

In .NET Rocks episode #525, they talk about monitors/visualizers new to VS2010 that help you understand what your multi-threaded software is actually doing at runtime (where it's locking, etc). Does that (or related) feature give any new visibility to the behavior of multi-threaded apps running in version 2.0 of the .NET CLR? ...

how to guarantee no deadlock

I was stuck at one question in an interview. Given two threads, and each one has a lock, how to guarantee no deadlock. My knowledge is that it is not easy to avoid deadlock, that's why I got stuck. Can anybody give a hint. Thanks! ...

Given an event on one thread, what is the best approach to execute a task/method on another thread in .Net?

Here is specifically what I am seeking to accomplish: Using .Net 3.5, I have a Windows Service, within which I have a WCF Service running. I have a client, which requests a file from the WCF Service (Net.Tcp binding), which is then copied by the WCF service to a specified location, where it can then be edited/modified by the client. The...

Intel Thread Building Blocks Concurrent Queue: Using pop() over pop_if_present()

What is the difference in using the blocking call pop() as compared to, while(pop_if_present(...)) Which should be preferred over the other? And why? I am looking for a deeper understanding of the tradeoff between polling yourself as in the case of while(pop_if_present(...)) with respect to letting the system doing it for you. This...

What tool is my best bet for threaded Haskell debugging today?

Erlang's got its multi-process debugger that let's you see all your processes. Anything similar in Haskell? ...

C# Wait until all threads terminated in ThreadPool

I have one main thread, and many other background threads. The main usage of those background threads is to query data (many queries from the web, which is why I create multiple threads: to avoid the lagging the user interface). When it comes to exporting the data in the main thread (the user interface), I need to wait until all the ot...

Thread type for background drawing to a bitmap in MFC

I have a MFC document/view C++ graphics application that does all its drawing to an off screen bitmap, and then copys that to the supplied CDC pointer in the OnDraw method. Over the last couple of days I've been looking to place the drawing component in a seperate worker thread, so it doesn't stall the GUI. I seem to get a fair number ...

ObservableCollection in Model + Threading in ViewModel

Our offsite development team created a Model with an ObservableCollection property. Now, I'm in charge of creating the ViewModel, and I'm having trouble because the said Model runs inside a BackgroundWorker (another thread)- which means I can't update the View by hooking the CollectionChanged events. Here's the workaround that I did: pr...

Java socket threading trouble

Hello all, I am building a java application that listens on 2 ports simultaneously and is also capable of multithreading. How Im doing this is as follows. I have a very basic GUI in PortApp.java which takes in 2 integers through 2 textfields and also has a listen button. So when the listen button is clicked, the following code is execut...