multithreading

Boost::Thread or fork() : Multithreaded HTTP Proxy

I'm testing boost::thread on a system. It happens that I needed to act as a fork(), because one thread modifies the other variables, even member variables of class I do the project using fork() or is there some alternative still using boost::thread? Basically I run this program in Linux and maybe FreeBSD. It is an http proxy,accept() ...

How can I simulate this application hang scenario?

I have a Windows Forms app that itself launches different threads to do different kinds of work. Occasionally, ALL threads (including the UI thread) become frozen, and my app becomes unresponsive. I've decided it may be a Garbage Collector-related issue, as the GC will freeze all managed threads temporarily. To verify that just managed t...

WinForms - How do I access/call methods in UI thread from a separate thread without passing a delegate?

Hi, QUESTION: In .NET 3.5 WinForms apps, how do I access/call methods in UI thread from a separate thread, without passing a delegate? EXAMPLE: Say I have some code I want to run both (a) manually when the user clicks a button, and (b) periodically called by a process which is running in a separate non-mainUI thread but without passing...

How to schedule heavy work for later display for Listviews?

I have a listview with 200 items. I use a custom view for each row. There is a code that takes some time to calculate, and because of this the list hangs out on scrolling and loads in slow (2-3sec). I have subclassed SimpleCursorAdapter, and using Filterable and SectionIndexer. I have in mind to show initially the name of the record,...

Java Inter Process communication and Inter Thread communication ?

Hi, First , what is the difference between Thread and a Process in Java context? and How Inter Process communication and Inter Thread communication is acheived in Java? Please point me real time examples. Thx ...

How do you call a generic method on a thread?

How would I call a method with the below header on a thread? public void ReadObjectAsync<T>(string filename) { // Can't use T in a delegate, moved it to a parameter. ThreadStart ts = delegate() { ReadObjectAcync(filename, typeof(T)); }; Thread th = new Thread(ts); th.IsBackground = true; t...

C# Spawn Multiple Threads for work then wait until all finished

just want some advice on "best practice" regarding multi-threading tasks. as an example, we have a C# application that upon startup reads data from various "type" table in our database and stores the information in a collection which we pass around the application. this prevents us from hitting the database each time this information i...

Lock-free multi-threading is for real threading experts...

I was reading through an answer that Jon Skeet gave to a question and in it he mentioned this: As far as I'm concerned, lock-free multi-threading is for real threading experts, of which I'm not one. Its not the first time that I have heard this, but I find very few people talking about how you actually do it if you are interested i...

Monitoring/Managing processes,deamons,threads

My problem domain is to monitor/manage, processes, threads, daemons, on a remote machine. I have not choosen a language as yet to write the tool. I am open to suggestions. Clarification: 1) By Monitoring I mean "knowing current running state, memory usage, process usage ". 2) Would prefer very little setup requirements imposed. Assumpt...

I need to stop execution during recursive algorithm

Hey, I have a problem in choosing the right method to accomplish my goal. I'm working on Algorithms teaching system, I'm using C#. I need to divide my algorithm into steps, each step will contain a recursion. I have to stop execution after each step, user can then move to the next step(next recursion) using a button in my GUI. After se...

Start all tab's activities for pre-cache

I have a TabActivity with three tabs defined. The first tab is light-weight and renders in acceptable time. But the 2nd and 3rd tab, does need a couple of seconds to get visually rendered, after I click them. I would like to launch them, after I've loaded my first tab, in background for pre-cache. Once they are loaded, I can switch quick...

Reading ResultSet from multiple threads

Hello, In the database, I have a definition table that is read from the application once upon starting. This definition table rarely changes, so it makes sense to read it once and restart the application every time it changes. However, after the table is read (put into a ResultSet), it will be read by multiple handlers running in their...

multitreading scheduling related java

class A implements Runnable{ B b=new B(); public void run(){ while(true){ System.out.println("H1"+Thread.currentThread().getName()); } } } public class Test { public static void main(String[] str){ A a1 =new A(); // A a2 =new A(); // Thread t1 =new Thread(a1, "Vichi"); Thread t2 =new Thread(a1,"Vishu"); t1.start()...

ASP.NET - Update progress while processing data

Hope I can explain this correctly. I have a process, that outputs step by step messages (i.e., Processing item 1... Error in item 2 etc etc). I want this to be outputted to the user during the process, and not at the end. I pretty sure i need to do this with threading, but can't find a decent example. Thanks in advanced. ...

Do condition variables still need a mutex if you're changing the checked value atomically?

Here is the typical way to use a condition variable: // The reader(s) lock(some_mutex); if(protected_by_mutex_var != desired_value) some_condition.wait(some_mutex); unlock(some_mutex); // The writer lock(some_mutex); protected_by_mutex_var = desired_value; unlock(some_mutex); some_condition.notify_all(); But if protected_by_mutex...

Of these 3 methods for reading linked lists from shared memory, why is the 3rd fastest?

I have a 'server' program that updates many linked lists in shared memory in response to external events. I want client programs to notice an update on any of the lists as quickly as possible (lowest latency). The server marks a linked list's node's state_ as FILLED once its data is filled in and its next pointer has been set to a valid ...

Java Thread Example ?

Hi, Anyone give example program which explains Java Threads in a simpler way.For example,we have the following threads t1 , t2 and t3 . Here I want code that shows each thread is executing simultaneously not sequentially like non-threaded java programs. Thx ...

Final enum in Thread's run() method

Hi, Why is the Elvis elvis definition has to be final to be used inside the Thread run() method? Elvis elvis = Elvis.INSTANCE; // ----> should be final Elvis elvis = Elvis.INSTANCE elvis.sing(4); Thread t1 = new Thread( new Runnable() { @Override public void run() { elvis.sing(6); // --------> elvis has to be final to c...

How to cancel AsyncTask when Activity finishes?

In my Activity I use multiple AsyncTask classes. How to cancel AsyncTask when Activity finishes? ...

iphone threading speed up startup of app

I have an app that must get data from the Sqlite database in order to display the first element to the User. I have created a domain object which wraps the DB access and is a thread safe singleton. Is this following strategy optimal to ensure the fastest load given the iPhone's file access and memory management capabilities in threaded...