multithreading

not enough storage is available to process this command in visual studio 2008

I am trying to write a multi-thread program in visual studio (c++). I get this error message when I increase the number of one active class. Is there any way I can get around this problem? I mean should I change some of the setup or should I do something to my code? ...

Thread-per-character vs Thread-per-map design

I want opnion about multithreading design in java. Between thread-per-character and thread-per-map/zone. Which is more advantage (or other way) and game server can handles 3000+ players. ...

Is there a way to cancel "AsyncWaitHandle.WaitOne()"?

Hi, thanks in advance for helping. I want to cancel the AsyncWaitHandle.WaitOne() at some point in my code (meaning I do not want to block anymore), but I just cann't find the way to do it. Perhaps, it is the logical problem of my program, but I can not think of any other way to break out of the loop as soon as exit signal is given. The...

When does a performSelectorOnMainThread call get executed?

If I use a performSelectorOnMainThread call inside a detached thread, when does the main thread execute the request? Does it do so immediately after it finishes the current main thread operation, or is there some other type of hierarchy that determines when the performSelectorOnMainThread call executes? ...

Store Application Progress to Database

Hi, I have a daily launched multi-threaded loading service. I would like to keep tack of the percentage progress of the loader. I was thinking that it would be good to have an update column on a database table that writes the %Progress. Is this a good idea or will there be a large overhead(5k updates per minute). Is there a better way t...

How to listen multiple serial ports with C#

Hello everybody, I am using Serial COM Simply in C# by Noah Coad http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=320 and I have available ports on my machine whichs COM1,COM2,COM6,COM7,COM8,COM9,COM10,COM11,COM12,COM13 and I use COM6,COM7,COM8,COM9,COM10,COM11,COM12 with ZyXEL Omni 56K modem, I use these 7 ports wit...

Keeping track of multiple threads on iphone

I'm trying to do something basic to understand threads with a counter that just increments when a button is pressed, and every time the button is pressed, a new thread incrementing the same counter starts. Then I have a stop button to stop a thread that is running. How can I tell how many threads, or which thread is running? Here is m...

Why does this code print the same thing twice?

I am trying to write some small timeout code: t = Thread.new { sleep 3 } # <- The thread that will do stuff. Thread.new { sleep 2; t.kill; p 'hi!' } # <- The thread that will kill it after two seconds. t.join If the first thread completes it's job within two seconds, it will stop, and the main thread will have nothing to do. This will...

new to multithreading- how to use wait() and notify() in java?

I'm trying to write a program with 2 classes, a controller and a class that does a lot of computation. The controller creates a couple instances of the other class, then tells them all to start their calculations (in parallel). They each return when they are finished, and the controller resumes, and then, some time later, the controller ...

Creating a thread hangs MFC dialog app on termination

Hi. I've narrowed down a problem. I create a simple Dialog app with VC++ 6.0. I start a thread before the main dialog DoModal() is called I exit the application - sometimes the app shuts down immediately, other times it hangs for 10 seconds or so What causes this? I have tried _beginthread(), _beginthreadex() and AfxBeginThread(). T...

Multithreading and Delegates Execution

I created an object that has specific method to process different kind of events and will lived until my application is running. I also created individual delegates pointing to each methods and are referenced to x number of threads. Given y and z thread will invoke method1 by using a delegate pointing to it, will z thread wait for y thr...

Operating System Implementation of events/signals/wait handles

Out of curiousity I was wondering how Operating Systems implement waking threads that are waiting on events/handles etc. For example say an OS thread continually scans through a list of wait handles and executes the respective threads if necessary. Not that I believe its implemented this way as it would seem inefficient. I think its m...

Any obvious problems or improvements for my producer consumer queue.

I asked a previous question about producer/consumer code that was overly general (though the answers were certainly helpful). So I've taken the suggestions from an earlier SO question by another author and converted them to C++ and boost. However I'm always a bit concerned about multithreaded code - so if anyone can see any obvious impro...

Calling a method on a child form from the parent form

hi, I have 2 forms ParentForm and a child form. In my parent form I have a thread listener which listens to a feed which updates an area of the ParentForm. Now, I have a ChildForm which also needs the data from the listener to be placed on an area of the ChildForm. the thread listener uses delegate to update my ParentForm when it gets...

What's the best way to demonstrate the effect of affinity setting?

Once I noticed that Windows doesn't keep computation-intensive threads on a specific core - it keeps switching cores instead. So I speculated that the job would be done faster, if the thread would keep access to the same data caches. And really, I was able to observe a stable ~1% speed improvement after setting the thread's affinity mask...

How to allow certain threads to have priority in locking a mutex use PTHREADS

Hi, Assume that the following code is being executed by 10 threads. pthread_mutex_lock(&lock) Some trivial code pthread_mutex_unlock(&lock) For purpose of explanations lets say the threads are T1, T2, T3.....T10. My requirement is that as long as T1 or T2 or T3( i.e any of T1, T2 or T3) is waiting for acquiring a lock, the other thre...

How to solve the "Cross-thread operation not valid" Problem ?

I have a windows forms dialog, where a longer operation is running (asynchron) within a backgroundworker job. During this operation I want to change some values on the form (labels,...). But when the backgroundworker tries to change something on the form, I get the error "Cross-thread operation not valid"! How can this problem be solved ...

Parallel Programming with Tools.

I was looking into Intel's Parallel Studio. It said it is for C & C++ programmers. I know C# 4.0 has a lot of parallelism features. I like a few things in Parallel Studio. Can Parallel Studio be used for C# as well? ...

Should I use Thread.BeginThreadAffinity() when using impersonation?

I understand that impersonation is tied to a single thread. However, managed threads could be shuffled around on top of native Win32 threads, so should I try to bind the identity using Thread.BeginThreadAffinity()? And should I use Thread::ManagedThreadId when checking calls later on an object that manages the impersonation? EDIT: But ...

Non-blocking concurrent collection?

System.Collections.Concurrent has some new collections that work very well in multithreaded environments. However, they are a bit limited. Either they block until an item becomes available, or they return default(T) (TryXXX methods). I'm needing a collection that is thread safe, but instead of blocking the calling thread it uses a c...