multithreading

Best .NET language for Concurrent programming

This may be a question that others have seen, but I am trying to find the best language for concurrent programming that can run on the .net platform. I have been doing side development in erlang to get a feel for the language and have loved how easy it is to get a stable concurrent or even distributed system up. It led me to scala wh...

The correct way to implement ThreadPool.RegisterWaitForSingleObject

Hi, I am trying to use ThreadPool.RegisterWaitForSingleObject to add a timer to a set of threads. I create 9 threads and am trying to give each of them an equal chance of operation as at the moment there seems to be a little starvation going on if I just add them to the thread pool. I am also trying to implement a manual reset event a...

Simple Threading, why does this happen? (C# WinForms)

I'm currently exploring threading implementation in C# WinForms and I created this simple app: I'm just wondering why the memory usage of this app keeps growing after I start, stop, start, and stop again the application. I'm having a thought that my thread instance doesn't really terminate or abort when I press the stop button. Please c...

Hangs on CreateDialogIndirect in CWinThread derived class.

I'm new to multithreading. I created a class inherit from CWinThread called CMyUIThread, and also a dialog called CMyInfoDlg which has a text and a progress ctrl. I would to show modeless dialog in new created thread. Below is partial code: BOOL CMyUIThread::InitInstance() { // TODO: perform and per-thread initialization here // NOTE:...

how to get the mvc right on android?

hi there! i'm kinda new to programs which feature an mvc architecture and i want to get the right idea right up front... i have this (android) application, where a thread (separate from the UI thread) computes some data. when finished, the results are written to a member of an object. now: how do i get the UI thread to "realize" that t...

C# Console App Threading?

Hi, I'm about to write a console app which will run once a week at 2am on Sunday Morning. It's going to interrogate a SQL server database, then perform some calculations and then write the results to a new database. It's processing hundreds of thousands of records so it's going to take hours to complete. I'm going to create a C# co...

Java threading JavaDoc

I have written a method which should only be called on a particular thread. Is there a standard annotation or note which should be added to the method's javadoc to denote this? ...

know when a new thread was created in the AppDomain your application is running after?

hi, i would like to know if there is anyway to get an event (or something other) that tells you when a new thread was created on your appdomain (C# application)? the basic idea is that when a new thread is created i need to "initialize" the thread with some settings. i do not want to go all over my code and do that, as well as i don'...

How to safely use a library that makes callbacks on arbitrary threads

I have a library with an API much like this: public class Library : IDisposable { public Library(Action callback); public string Query(); public void Dispose(); } After I have instantiated Library, at any time and on any thread it might invoke the callback I have passed to it. That callback needs to call Query to do useful...

What is multithreading?

I'm very curious in what multithreading is. I have heard the name battered around here and there in answers I have received on StackOverflow but I have no idea what it is, so my main two questions being what is it and how can I benefit from it? EDIT: Ok, since the first question didn't really get the response I was looking for I'll go ...

When the UI thread is sleeping, can invoke methods from background threads block indefinitely?

When I call Thread.Sleep on the UI thread, does all invoke methods from background thread automatically get queued up in the message pump of the UI thread and processed when it eventually wakes up? I'm having problems with a winform app that uses a lot of threadpool threads and sometimes the app hangs after locking/unlocking Windows. On...

C#: Using AsParallel()/Parellel.ForEach() guidelines?

Looking for a little advice on leveraging AsParallel() or Parallel.ForEach() to speed this up. See the method I've got (simplified/bastardized for this example) below. It takes a list like "US, FR, APAC", where "APAC" is an alias for maybe 50 other "US, FR, JP, IT, GB" etc. countires. The method should take "US, FR, APAC", and convert ...

wpf forcing update UI window during a procedure

Hi everyone! I need only to show a custom control (a clock with rotating hands) and with this to replace the mouse cursor, if I use a file .cur or .ani to replace the mouse cursor Me.CUrsor = New Cursor("absolute path of the .ani file") there is no problem: I can change the cursor during a procedure: but the quality of the animation is ...

Node.js, process and threads question

Does process have at least one thread running? If so, then the Node.js will by default have 1 main thread and 1 event loop thread running? ...

How/where is the working directory of a program stored?

When a program accesses files, uses system(), etc., how and where is the current working directory of that program physically known/stored? Since logically the working directory of a program is similar to a global variable, it should ideally be thread-local, especially in languages like D where "global" variables are thread-local by def...

2nd BeginInvoke call claims already completed. Why?

I'm repeatedly calling a method with BeginInvoke. After each call, I call EndInvoke. The problem is that for the second call, the IsCompleted member in the returned IAsyncResult is set to true IMMEDIATELY after the BeginInvoke call. This causes a malfunction, because the program then thinks the second call is done. Why does it do thi...

Assigning a object to a field defined outside a synchronized block - is it thread safe?

Is there anything wrong with the thread safety of this java code? Threads 1-10 add numbers via sample.add(), and Threads 11-20 call removeAndDouble() and print the results to stdout. I recall from the back of my mind that someone said that assigning item in same way as I've got in removeAndDouble() using it outside of the synchronized bl...

What does "readback" mean in terms of computer memory?

I am messing with multiple threads accessing a resource (probably memory). What does "readback" mean in this context? Any guides will be helpful... Google didn't give me any good results. ...

Threads in userspace and yield

I am supposed to implement a userlevel threads library in C. To do so, I need to implement yield(), createThread() and destroyThread() functions. I believe I've got the basics right: To keep track of threads, I'll use a queue of ThreadControlBlock elements (which resemble PCBs in an OS) that look like this: struct ThreadControlBlock { ...

NotSupportedException on WaitHandle.WaitAll

I am trying to execute the following code. The code tries to parallely download and save images. I pass a list of images to be downloaded. I wrote this in C# 3.0 and compiled it using .NET Framework 4 (VS.NET express edition). The WaitAll operation is resulting in a NotSupportedException (WaitAlll for multiple handles on a STA thread is ...