multithreading

Best Practice: Blocking execution while waiting for an Async method

I am trying to adapt an existing program (internally written) to use a different library than it originally did. I've abstracted most of library-specific code away (seems to be the easier part). The issue is, the old library would execute a call using a blocking method, and our internal program is expecting a blocking method to be ca...

Minimal-locking thread-safe hashtable?

Are there any available implementations of a Hashtable that provide thread safety with minimal locking in .NET? Or in another language that can be ported to .NET? We're looking for something in between using a BCL Dictionary<,> class with lock() and a distributed caching application like memcached or Velocity. The intended use is for ...

NSOperation blocks UI painting?

Hi, I'm after some advice on the use of NSOperation and drawing: I have a main thread create my NSOperation subclass, which then adds it to an NSOperationQueue. My NSOperation does some heavy processing, it is intended to loop in its main() method for several minutes, constantly processing some work, but for now I just have a while() ...

how to scale this single threaded java client?

I'm writing a Stomp protocol client with Java and it has only one thread to process IO. That means that thread reads and writes incoming data to the application back and forth. My issue is if I need to scale this application in future with multi threading and NIO, how that could be arranged? my IO processor thread is called "TcpLink" li...

Progress status from a new thread

I am executing time consuming task in a new thread. ParameterizedThreadStart pts = new ParameterizedThreadStart(WorkingFoo); Thread thread = new Thread(pts); The WorkingFoo executing the task and keeps track of the progress steps (it can return the total number of "steps" and the current step). I want to display this information ...

gdb - "thread apply all bt full" gives blank

I was trying to debug a multi-threaded process on a Linux server running Slackware 12 using gdb 6.6 Once I attach and issue the command "thread apply all bt full" it comes back with nothing ( back on to the gdb prompt ). Any idea why this happens? ...

Get information about running processes

I need to start a monitor on some machines to find out which processes are locking it. So what I would like is logging about the same information you can find on the Task Manager about each executing process. So far I can have the Processor Time information with the C# Process Class, but I would also like to know how much memory it is u...

Using lock statement within a loop in C#

Lets take the sample class SomeThread where we are attempting to prevent the DoSomething methods from being called after the Running property is set to false and Dispose is called by the OtherThread class because if they are called after the Dispose method is the world would end as we know it. It feels like there is a chance for somethi...

OpenGL Threaded Tile Texture Loading with Qt 4.5 / 4.6

Hi, I am trying to develop am map application for scientific purposes at my university. Therefor I got access to a lot of tiles (256x256). I can access them and save them to an QImage in a seperate QThread. My Problem is, how can I actually manage to load the QImage into a texture within the seperate QThread (not the GUI main thread)? Or...

How can I keep on-the-fly application-level statistics in an application running under Apache?

I have an application running under apache that I want to keep "in the moment" statistics on. I want to have the application tell me things like: requests per second, broken down by types of request latency to make requests to various backend services via thrift (broken down by service and server) number of errors being served per sec...

How to handle this (db) queue race condition?

Basically i have multi threads that adds data into a queue via SQLite. I have another one thread that pulls them and process them one at a time (too much resource to do multiple at once). The processing thread does this: pull data from DB foreach { proccess } if count == 0 { thread.suspend() } (waken by thread.resume()) repeat my wor...

Convert Ping application to multithreaded version to increase speed - C#

I have an application that pings every possible IP on your local subnet in order to compile a list of responsive IP addresses. Currently it pings all 255 one at a time. Is it possible to convert this app to use multiple threads to increase the speed by pinging more than one at a time? I am new to the concept of multiple threads and fi...

Delphi - Help calling threaded dll function from another thread

I'm using Delphi 2006 and have a bit of a problem with an application I'm developing. I have a form that creates a thread which calls a function that performs a lengthy operation, lets call it LengthyProcess. Inside the LengthyProcess function we also call several Dll functions which also create threads of their own. The problem that I...

C# Nested Synchronization

I have a class with several data members: public class Foo { List<int> intLst; int Whatever; HashTable<string> hshTable; ... } I then have a function within Foo that takes two Foos and merges them into a new Foo. I would like to make the Foo class thread safe too. Is the below code the best way to do this? public Fo...

Threaded HTTP Post Application

Hi All, I have an application that performs HTTP posts at regular intervals (data retrieved from SQL). Every 30 seconds a maximum of 50 threads are spawned and run HTTP posts concurrently. If a post fails, it waits 2x as long as the interval is set to. This will happen twice. So for instance, 30s, 60s then 120s. I am using a normal Thr...

Why POSIX is called "Portable Operating System Interface"?

I have searched hard but still confused why POSIX is called "Portable Operating System Interface", what I learned is that it is some threading library for Unix environment, because when you need to use it under windows you have to use cygwin or "Windows Services of Unix", etc. That's why I am confused why it is called Portable OSIX. I a...

Java threads query

hello all, Im working on a java application that involves threads. So i just wrote a piece of code to just familiarize myself with the execution of multiple yet concurrent threads public class thready implements Runnable{ private int num; public thready(int a) { this.num=a; } public void run() { System.out.println("This is threa...

Applet getting Hang

I found following post http://stackoverflow.com/questions/370710/java-6-jvm-hang with somewhat similar exception that am getting. There is no deadlock. But many threads are in WAIT state. Stack trace is as follows. My Client JRE is 1.6.0_18. "Applet 1 LiveConnect Worker Thread" prio=4 tid=0x03382800 nid=0xe40 in Object.wait() [0x03acf00...

Java threads doubt

I had earlier posted a query on Java threads. ( link text) And based on the answers i received, i decided to implement them. So ive done this bit of coding on a machine with 2 cpu cores. The code is as follows import java.net.*; import java.io.*; public class thready implements Runnable{ private Socket num; public thready(Socket a) ...

NSOperation for drawing UI while parsing data?

Hi, Hope you guys can help me :) In the main thread, I create a NSOperation and add it to a queue. What that operation do is connect to a data server with NSURLConnection, save the receivedData and parse it. Operation.m - (void)start { NSLog(@"opeartion for <%@> started.", [cmd description]); [self willChangeValueForKey:@"i...