multithreading

NSObject PerformSelector Issue

Hooooookay so here's another "I just have no idea what's going on" problem: The first time I make a call to getFullWL() below, I get all my values as expected. Each subsequent call, however, returns nan instead of the true value(-nan(0x400000000) in XCode or something) Furthermore, if I put my "debug" lines in SFLog the value prints a...

Multi-threaded ObservableCollection in VB

This is my attempt to create a ObservableCollection in VB that is WPF thread-safe. Can you think of any problems it may have? Public Class WpfObservableCollection(Of T) Inherits ObjectModel.ObservableCollection(Of T) Public Sub New() End Sub Public Sub New(ByVal list As List(Of T)) MyBase.New(list) End Su...

Creating a QThread event loop in an existing non QT thread

My code is a plugin of a host software which gets limited processing time. Therefore, I create a second thread (via system API) and start QApplication there. That way, the GUI runs smoothly. Now, I would like to run a QThread event loop in the original such that I could use Signal/Slot (Qt::QueuedConnection) to invoke functions that are...

Java Threads memory explosion

Hi, I am fairly new with concurrent programming and I am learning it. I am implementing a quick sort in Java JDK 7 (Fork Join API) to sort a list of objects (100K). While using this recursive piece of code without using concurrency,i observe no memory explosion, everything is fine. I just added the code to use it on multi cores (by ...

Design choices for high performance file serving

I'm developing an application under linux that will need to support around 250 connections and be transmitting large files over TCP sockets in the 100MB+ size range. The aim is to tune for throughput rather than latency. I want to keep saturated 2x1Gbit ethernet connectons at all times. These will be channel bonded. It's expected tha...

Perl threads slowly consume memory

I am running a Perl server with 10 threads. They never get destroyed until the program exits, but this is something I intend to have as much uptime as possible, so that's why this is an issue for me. The threads handle a simple task many times. When I start the server and all the threads are started, I see that I have 288.30 MB free. Aft...

Explain how it works mutex

Hello, Now i'm try to learn multithreading and mutext. But i don't understand it. For example i add items to list in anotyher thread then main programm: GMutext* lock; g_mutex_lock (lock); g_list_prepend(list, "Some data"); g_mutex_unlock (lock); What happens in this case with the list? The list of added elements, as well as no acces...

Memory access by multiple threads

Hi all. I'm writing a multi threading java application that runs on Nehalem processor. However I have a problem that starting from 4 threads I almost don't see the speedup in my application. I've made some simple test. I've created a thread that just allocates a big array and making access to random entries in the array. So when I run ...

Ant <input/> no longer working in Eclipse Helios (3.6)

I have a build file in my Eclipse projects. One of the things this file does is ask a question via a prompt, using the <input/> tag. Since upgrading to Eclipse Helios, this no longer works, as I'm getting the following error: [input] ***WARNING: Display must be created on main thread due to Cocoa restrictions. Invalid thread access Ho...

InvokeRequired method - codereview help

Hi! To start with im not that experienced in Window.Forms development. However i find the InvokeRequired checks, for controls, a bit tedious when used in a threaded application. Ive created a static method that i think solves my tedious InvokeRequired checks. Just want to throw this out into the open to see if its a bad "pattern": pub...

How to write a test case for ensuring thread-safe

Hi, I wrote a thread-safe(at least the aim is that) container class in C++. I lock mutexes while accessing the member and release when finished. Now, I try to write a test case if it is really thread safe. Let's say, I have Container container and two threads Thread1 Thread2. Container container; Thread1() { //Add N items to the co...

Most efficient way of implementing an alarm on iPhone

I have implemented a simple clock like so: - (void)runTimer { timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(showActivity) userInfo:nil ...

Cancel backgroundworker.

Hello everybody! I have UI which displaying status of long-running operations (downloading some text files from ftp) . For my purposes I use backgroundworker and I can't cancel operation. void worker_DoWork( object sender, DoWorkEventArgs e ) { try { int rowIndex = (int)e.Argument; //begin ...

How to write multi-threaded unit tests?

I'd like to know if there are some unit testing frameworks which are capable of writing multi-threaded tests easily? I would imagine something like: invoke a special test method by n threads at the same time for m times. After all test threads finished, an assertion method where some constraints should be validated would be invoked. My...

JTextFields on top of active drawing on JPanel, threading problems.

Dear developers, Has anyone ever tried to use Swing to construct a proper multi-buffered rendering environment on top of which Swing user interface elements can be added? In this case I have an animating red rectangle drawn onto a background. The background does not need to be updated every frame so I render it onto a BufferedImage an...

Thread.Sleep(0) : What is the normal behavior?

To my understanding a Thread.Sleep(0) force a context switch on the OS. I wanted to check what was the maximum amount of time that could pass in an application before to receive some CPU time. So I built an application that does Thread.Sleep(0) in a while loop (c#) and calculate the time that pass between each call. When this applicat...

C# Action vs. Event vs. Queue performance

I have a Camera class that produces very large images at a high FPS that require processing by a ImageProcessor class. I also have a WPF Control, my View, that displays this information. I need each of these components needs to run on it's own thread so it doesn't lock up the processing. Method 1) Camera has an Action<Image> ImageCreate...

How do I do threading in python?

I am trying to learn how to use threads with python. this is the code I have been studying: import time from threading import Thread def myfunc(i): print "sleeping 5 sec from thread %d" % i time.sleep(5) print "finished sleeping from thread %d" % i for i in range(10): t = Thread(target=myfunc, args=(i,)) t.start() ...

Good advices to use EF in a multithread program ?

Have you got some good advices to use EF in a multithread program ? I have 2 layers : a EF layer to read/write into my database a multithread service which uses my entities (read/write) and makes some computations (I use Task Parallel Library in the framework) How can I synchronize my object contexts in each thread ? Do you know a g...

How do I do threading in python?

using code from this site: http://www.saltycrane.com/blog/2008/09/simplistic-python-thread-example/ The code is import time from threading import Thread def myfunc(i): print "sleeping 5 sec from thread %d" % i time.sleep(5) print "finished sleeping from thread %d" % i for i in range(10): t = Thread(target=myfunc, args...