multithreading

Is parallel programming == multithread programming ?

Is parallel programming == multithread programming? ...

WCF named pipes service settings

Is it worth to set the service with ConcurrencyMode.Multiple and InstanceContextMode.Single attributes to save some performance when using named pipes ? I mean when I do so I have to bother with multithreading issues. ...

How can I write my application as a multithreaded application in C#?

I have a C# Windows application that does many tasks. some of these tasks are very time wasting. When I run these type of tasks, the other parts of my application will be disabled. How can I write my application to avoid this? Is using threads a good solution? Is it safe? ...

how many async socket requests can be going on on the same socket?

When I call BeginSend on a socket, I pass a delegate which will be called (by a different thread) when the data has been sent. What would happen if I call BeginSend another time while the first has not yet been 'callbacked'? What is the correct behavior to send data? do BeginSend, and on the callback do EndSend and start another send? ...

Handler fails to deliver a message or a Runnable to the main thread

Hello! I have an app with a two threads - main and data loader. When data loader finishes it posts a Runnable object to the main thread (as described in the DevGuide), but it never gets delivered and run. Here's the basic code: class MyApp extends Application { public void onCreate() { LoaderThread t = new LoaderThread(...

Thread Interrupt

When an Thread.interrupt() is called on some thread, what happens to that thread? ...

How to check a thread is done, then fill progress bar in C# / WPF

I am just working on my first GUI application on Windows. I have a WPF GUI to a small C# utility which copies files. When the button is clicked to copy, I obviously don't want the GUI to hang. So, I fire off a new thread to run the method which copies the files. I assume I'm on track so far and there's no "better" way of doing it in C#?...

how to get access to the window in the wpf multi thread app

I have a separate thread that listens for data. And on receiving some data it needs to access one of the windows in the app and set some fields for that window. Right now when I use this it throws an exception(saying this threads cannot access as Windows1 is owned by other thread): foreach (Window w in App.Current.Windows) ...

What's a useful pattern for waiting for all threads to finish?

I have a scenario where I will have to kick off a ton of threads (possibly up to a 100), then wait for them to finish, then perform a task (on yet another thread). What is an accepted pattern for doing this type of work? Is it simply .Join? Or is there a higher level of abstraction nowadays? Using .NET 2.0 with VS2008. ...

Interrupt method execution after arbitrary time in Python

I have some method doA() that occasionally hangs for a while. Are there any common modules in Python that can control time of doA() execution and interrupt it? Of course, it may be implemented via threads, so simple wrapper around threading module may be good solution. In other words i'd like to have code like: import CoolAsyncControl ...

ActiveX in Delphi blocking VCL thread

Running into kind of a strange problem: I'm using delphi 6.0 and trying to integrate a third party activex control which connects to a server, streams and renders video (no visibility into this control). The control has a frame rate setting from 1 - 30 and if i set this to a small value like 1, the VCL thread seems to block for a secon...

Java Methods Running in threads

I understand the concept behind threading and have written threads in other languages, but I am having trouble understanding how to adapt them to my needs in java. Basicly at present I have a vector of objects, which are read in from a file sequentially. The file then has a list of events, which need to happen concurrently so waiting f...

C# Instant messaging

Hi I'm working on a instant messaging program in C#(for learning only). Just wanna to know if my way is right or wrong. I created a Client class whice contains a NetworkStream and Read/Write functions. The server creates a new thread for every client, the thread listen for any new messages. Any better way? ...

DB-connection in separate thread - what's the best way?

I am creating an app that accesses a database. On every database access, the app waits for the job to be finished. To keep the UI responsive, I want to put all the database stuff in a separate thread. Here is my idea: The db-thread creates all database components it needs when it is created Now the thread just sits there and waits for ...

Webrequest sudenly stops working

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(baseurl + url); req.Timeout = 1000 * 10; HttpWebResponse response = (HttpWebResponse)req.GetResponse(); Stream str = response.GetResponseStream(); HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument(); doc.Load(str); response.Close(); string imgurl = doc.DocumentN...

Need some advice to make the code multithreaded.

Hi all, I received a code that is not for multi-threaded app, now I have to modify the code to support for multi-threaded. I have a Singleton class(MyCenterSigltonClass) that based on instruction in: http://en.wikipedia.org/wiki/Singleton_pattern I made it thread-safe Now I see inside the class that contains 10-12 members, some with g...

Test a lock with out acquiring it?

I have objects, they get locks. I want to test if they are locked without acquiring a lock. The idea is if I TryEnter() they i have to Exit() if true to only check the lock correctly. Seems like a really basic question, how is it done? ...

ObservableCollection and threading

I Have an ObservableCollection in my class. And further into my class i have a thread. From this thread i would like to add to my ObservableCollection. But i can't do this: This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread. Note that this is not happening...

Does Linux Time Division Processes Or Threads

A prof once told us in class that Windows, Linux, OS X and UNIX scale on threads and not processes, so threads would likely benefit your application even on a single processor because your application would be getting more time on the CPU. I tried with the following code on my machine (which only has one CPU). #include <stdio.h> #inclu...

Does Parallel::ForkManager() module support synchronization on global variables?

I'm very new to this Parallel::ForkManager module in Perl and it has a lot of credits, so I think it support what I need and I just haven't figured out yet. What i need to do is in each child process, it writes some updates into a global hash map, according to the key value computed in each child process. However, when I proceed to cla...