multithreading

C++ threaded class design from non-threaded class

I'm working on a library doing audio encoding/decoding. The encoder shall be able to use multiple cores (i.e. multiple threads, using boost library), if available. What i have right now is a class that performs all encoding-relevant operations. The next step i want to take is to make that class threaded. So i'm wondering how to do this....

Parallel Task In C#.net

I have C#.net application. I wanted to run my application In Thread. But because of third party dll it dont allow to use application in multiThread. There is one object in thrid party dll ,which only allow to create instance at one time only. When i manually run application exe instnace multiple time & process my data it process succe...

How to get thread status..in Multi threading..

Hi, May be it sound dumb but if I want some computed value from other thread and other value from one more thread and this two value in my main thread how can I,if In case second thread completed before first one.it will create problem..so I just want is there any way that I can get the thread status means its still running or stop. Th...

C# Asynchronous Sockets questions.

Based on my reading and testing, with asynchronous sockets, the socket itself can be passed using state object (IAsyncResult result), also if store the socket as a private field, it would be captured by the callback methods. I am wondering how the IAysnResult is kepted between the BeginXXX and ReceiveXXX? It looks to me that after the B...

SetThreadName not working with Visual Studio 2005

SetThreadName does not set thread name with Visual Studio 2005, when used as below: DWORD threadId; HANDLE handle = CreateThread(NULL, stackSize, ThreadFunction, ThreadParam, CREATE_SUSPENDED, &threadId); if (handle) { SetThreadName(threadId, "NiceName"); ResumeThread(handle); } After opening the Th...

Looking for design advise - Statistics reporter

I need to implement a statistics reporter - an object that prints to screen bunch of statistic. This info is updated by 20 threads. The reporter must be a thread itself that wakes up every 1 sec, read the info and prints it to screen. My design so far: InfoReporterElement - one element of info. has two function, PrintInfo and UpdateDat...

Is PetraVM Jinx Beta 1 good?

PetraVM recently came out with a Beta release of their Jinx product. Has anyone checked it out yet? Any feedback? By good, I mean: 1) easy to use 2) intuitive 3) useful 4) doesn't take a lot of code to integrate ... those kinds of things. Thanks guys! ...

Threading heap and stack

How memory is allocated in case of spawning a new thread, i.e how memory heap, memory stack, and threads are related? I know this is fundamental (.net framework concept) but somehow I am not much aware of this concept. ...

How to make Stack.Pop threadsafe

I am using the BlockingQueue code posted in this question, but realized I needed to use a Stack instead of a Queue given how my program runs. I converted it to use a Stack and renamed the class as needed. For performance I removed locking in Push, since my producer code is single threaded. My problem is how can thread working on the (...

What are some good ways to do intermachine locking?

Our server cluster consists of 20 machines, each with 10 pids of 5 threads. We'd like some way to prevent any two threads, in any pid, on any machine, from modifying the same object at the same time. Our code's written in Python and runs on Linux, if that helps narrow things down. Also, it's a pretty rare case that two such threads wan...

CUDA, more threads for same work = Longer run time despite better occupancy, Why?

I encountered a strange problem where increasing my occupancy by increasing the number of threads reduced performance. I created the following program to illustrate the problem: #include <stdio.h> #include <stdlib.h> #include <cuda_runtime.h> #include <cutil.h> __global__ void less_threads(float * d_out) { int num_inliers; for...

How do I terminate a .NET thread that has had its call stack corrupted?

I have a thread in my application that is running code that can potentially cause call stack corruption ( my application is a testing tool for dlls ). Assuming that I have a method of detecting if the child thread is misbehaving, how would I terminate it? From what I read, calling Thread.Abort() on the misbehaving thread would be equiva...

.NET threading question

Is there any essential difference between this code: ThreadStart starter = new ThreadStart(SomeMethod); starter.Invoke(); and this? ThreadStart starter = new ThreadStart(SomeMethod); Thread th = new Thread(starter); th.Start(); Or does the first invoke the method on the current thread while the second invokes it on a new thread? ...

using the boost::scoped_lock(Mutex &mx, bool initially_locked) constructor gives me errors.

Isn't there a boost::scoped_lock constructor that takes a boolean as the second parameter? I thought I had used it before. boost::scoped_lock(Mutex &mx, bool initially_locked) The documentation for scoped_lock shows the second parameters as "unspecified". Anyone know what in the @(*$ that is suppose to mean?!? the errors I get are: ...

JavaScript multithreading in IE6?

Is JavaScript multithreading possible in IE6? Are there any third party libraries for this? ...

Using device variable by multiple threads on CUDA

I am playing around with cuda. At the moment I have a problem. I am testing a large array for particular responses, and when I get the response, I have to copy the data onto another array. For example, my test array of 5 elements looks like this: [ ][ ][v1][ ][ ][v2] Result must look like this: [v1][v2] The problem is how do I calc...

How do I write a analyzable thread dump format

I'm creating a global exception handling which collects some information before shutting down in some cases. One of this information is the current thread dump. i do this with following code: ManagementFactory.getThreadMXBean().dumpAllThreads(true, true); The problem is to write the information into a analyzable format for TDA. Is the...

TCP multicast and multithreading

I need to come up with clients that can multicast to other clients reliably. That implies I'll be using TCP to connect reliably between clients within a multicast group. Doesn't that come up to n^2 number of connections? That seems a little silly to me. Wouldn't/shouldn't there be a way to more easily multicast with reliability? EDIT: U...

Threading cost - minimum execution time when threads would add speed

I am working on a C# application that works with an array. It walks through it (meaning that at one time only a narrow part of the array is used). I am considering adding threads in it to make it perform faster (it runs on a dualcore computer). The problem is that I do not know if it would actually help, because threads cost something an...

In Perl, how can I wait for threads to end in parallel?

I have a Perl script that launches 2 threads,one for each processor. I need it to wait for a thread to end, if one thread ends a new one is spawned. It seems that the join method blocks the rest of the program, therefore the second thread can't end until everything the first thread does is done which sort of defeats its purpose. I tried...