multithreading

Where inside injected DLL to loop?

Hey guys, So I've got an application that starts another application with my DLL injected (with Detours). The entry point is DllMain. I can't do much from DllMain, and certainly cannot loop. So how do I call my DLL monitor functions every x seconds? I read you cannot create a thread from DllMain (at least until it returns) and its true ...

Stop/Interrupt threads blocked on wainting input from socket

As the title says I need a way to stop or interrupt a thread that is blocked wainting on an input from the socket. ...

Thread implemented as a Singleton

Hi all, I have a commercial application made with C,C++/Qt on Linux platform. The app collects data from different sensors and displays them on GUI. Each of the protocol for interfacing with sensors is implemented using singleton pattern and threads from Qt QThreads class. All the protocols except one work fine. Each protocol's run func...

Why was the method java.lang.Thread.join() named like that?

Does anybody know why the method join() member of a java.lang.Thread was named like that? Its javadoc is: Waits for this thread to die. When join is called on some thread calling thread is waiting for the other to die and continue execution. Supposedly calling thread will die as well, but still it's not clear why the author used th...

Does WCF convert parallel calls from the same client (using different threads) to be in serial?

I have self hosted net tcp WCF service that exposes two methods and the service is not thread safe and it is (PerSession) . I found that my colleague developer who is using the service, accesses the same service object from different threads, and till now it works fine. So I am asking if you have parallel call from the same client then...

What's best practice for a long running operation that updates data in a currently displaying iphone tableview?

Background: I have a tableview displaying about 8 sections each backed with my own PlaceList class representing a list of objects (the implementation uses an NSMutableArray). There are around 200 objects in total. Each section corresponds to how far away the object is from the current location (e.g. within 1 mile, within 10, 25, 50...et...

Clojure mutable storage types

I'm attempting to learn Clojure from the API and documentation available on the site. I'm a bit unclear about mutable storage in Clojure and I want to make sure my understanding is correct. Please let me know if there are any ideas that I've gotten wrong. Edit: I'm updating this as I receive comments on its correctness. Disclaimer: A...

How well does Valgrind handle threads and machine-level synchronization instructions?

I have a highly parallel Windows program that uses lots of threads, hand-coded machine synchronization instructions, and home-rolled parallel-safe storage allocators. Alas, the storage management has a hole (not a synchonization hole in the allocators, I'm pretty sure) and I'd like to find it. Valgrind has been suggested as a good tool...

Threading issues in C++

I have asked this problem on many popular forums but no concrete response. My applciation uses serial communication to interface with external systems each having its own interface protocol. The data that is received from the systems is displayed on a GUI made in Qt 4.2.1. Structure of application is such that When app begins we have ...

Using WPF (which requires STAThread) with an API that can't work with STAThread

I am writing a WPF application that has an optional dependency on an API that has a simple requirement; It MUST be initialized/used on a thread that does NOT have the STAThread attribute. Of course, WPF requires STA so that makes everything easy. In this case, WPF is required no matter what. This third party API is required only when th...

Find cpu-hogging plugin in multithreaded python

I have a system written in python that processes large amounts of data using plug-ins written by several developers with varying levels of experience. Basically, the application starts several worker threads, then feeds them data. Each thread determines the plugin to use for an item and asks it to process the item. A plug-in is just a p...

Recommended .Net soft real-time

I'm interested in getting comprehensive information about soft (hard too) real-time application in .Net 3.5/4 Winforms mainly (WPF perhaps). Google results for the thing are quite poor - some quides on parallelism only ... the question is how could I for example write a real-time patient-health monitoring client for some medical applianc...

multi threading

hi....i m doing a client-server application in which there are multiple clients and they are controlled by a single server.... here i m capturing screen of all clients and i want them to send towords server...so it requires multithreading.... so can anyone tell me how can i use multithreading in my application...? ...

submitting to and monitoring an unreliable webservice

I am building an ASP.NET website which will collect data from a user and submit it to a 3rd party webservice. The webservice is somewhat unreliable and for this reason there is a backup service. If a call to the primary service fails (timeout or some other error) then I need to flip a bit in a static class which will trip the system to ...

why can't a local variable be volatile in C#?

public void MyTest() { bool eventFinished = false; myEventRaiser.OnEvent += delegate { doStuff(); eventFinished = true; }; myEventRaiser.RaiseEventInSeperateThread() while(!eventFinished) Thread.Sleep(1); Assert.That(stuff); } Why can't eventFinished be volatile and does it matter? It would seem to me that in this case th...

C# game design - main loop aborting - A better way than Abort() and ResetAbort()?

i have some C# threading program (a game), that stops with a boolean (as most articles recommends). while (gameContinueRun) { createRound(); line1; line2; line3; line4; endRound(); } some code lines lock the game and wait until other thread will release it. lock (stateSync) { Monitor.Wait(stateSync) } to stop the thre...

C# exiting a using() block with a thread still running onthe scoped object

What happens to a thread if it is running a method in an object that was freed by exiting a using block? Example: using (SomeObject obj = new SomeObject ()) { obj.param = 10 ; Thread newThread = new Thread(() => { obj.Work(); }); newThread.Start(); } ... obj.Work() is running on a new thread but ob...

Dump stacktraces of all active Threads

Hey Guys, I'm trying to dump a list of all active threads including the current stack of each. I can get a list of all threads using threading.enumerate(), but i can't figure out a way to get to the stack from there. Background: A Zope/Plone app freaks out from time to time, consuming 100% of cpu and needs to be restarted. I have a fe...

Will using multiple threads with a RandomAccessFile help performance?

I am working on a (database-ish) project, where data is stored in a flat file. For reading/writing I'm using the RandomAccessFile class. Will I gain anything from multithreading, and giving each thread an instance each of RandomAccessFile, or will one thread/instance be just as fast? Is there any difference in reading/writing, as you can...

Can a call to WaitHandle.SignalAndWait be ignored for performance profiling purposes?

I just downloaded the trial version of ANTS Performance Profiler from Red Gate and am investigating some of my team's code. Immediately I notice that there's a particular section of code that ANTS is reporting as eating up to 99% CPU time. I am completely unfamiliar with ANTS or performance profiling in general (that is, aside from self...