multithreading

What is a thread pool in C++ and how it is implemented?

HI I just came across a new term thread pool. I don't know what it is, can any body offer some information about this? What it is a thread pool and how it is implemented? Is a thread pool just a collection of thread? ...

Thread pool stack security issue

In a naive implementation of a thread pool, can a piece of code that is being executed read the data left by some previous code on the stack (if it was running on the same thread instance)? Also, are there any other inherent security issues connected to thread pools? ...

Is it safe to use a boolean flag to stop a thread from running in C#

My main concern is with the boolean flag... is it safe to use it without any synchronization? I've read in several places that it's atomic (including the documentation). class MyTask { private ManualResetEvent startSignal; private CountDownLatch latch; private bool running; MyTask(CountDownLatch latch) { run...

Does Interlocked guarantee visibility to other threads in C# or do I still have to use volatile?

I've been reading the answer to a similar question, but I'm still a little confused... Abel had a great answer, but this is the part that I'm unsure about: ...declaring a variable volatile makes it volatile for every single access. It is impossible to force this behavior any other way, hence volatile cannot be replaced with Int...

"Arithmetic operation resulted in overflow" in Me.Invoke with multithreading

Hey everyone, I have this script: Private Sub WebDL_AmountDownloadedChanged(ByVal iNewProgress As Long) Handles WebDL.AmountDownloadedChanged 'On Error Resume Next If downloading Then Dim wbchanged As New WDL_AmountDownloadedChanged(AddressOf WebDLAmountChanged) Me.Invoke(wbchanged, New Object() {CLng(iNewPr...

Who interrupts my thread?

I understand what an InterruptedException does and why it is thrown. However in my application I get it when waiting for SwingUtilities.invokeAndWait() on a thread that is only known by my application, and my application never calls Thread.interrupt() on any thread, also it never passes the reference of the thread on to anyone. So my q...

How to specify the user in a C# Thread

Hi, how can I spawn the thread T from application A so that that application A's user is U1 (like me) but thread T's user is U2 (like a superuser)? Thanks ...

What are common uses of condition variables in C++?

I'm trying to learn about condition variables. I would like to know what are the common situations where condition variables are used. One example is in a blocking queue, where two threads access the queue - the producer thread pushes an item into the queue, while the consumer thread pops an item from the queue. If the queue is empty, t...

Thread-safe data structure design

Hello, I have to design a data structure that is to be used in a multi-threaded environment. The basic API is simple: insert element, remove element, retrieve element, check that element exists. The structure's implementation uses implicit locking to guarantee the atomicity of a single API call. After i implemented this it became appare...

What is the significance of Thread.Join method in c sharp .net ?

What is the significance of Thread.Join method in c sharp .net ? MSDN says that it blocks the calling thread until a thread terminates. Can anybody explain this with a simple example ? ...

Should I use two threads which can kill each other?

I would like to have a window with a simple form (radio buttons and so on). Users can make there selections and press a "Submit" button. Additionally to that I would like to set some time limits. In more details, user should see how many seconds he/she still have (so, there should be a timer). If the time limit is exceeded, program close...

stop thread till other complete

How to stop thread till other thread is running. How can i check thread is running and stop thread in c# ...

How do I run different threads in Java?

Hey. I'm having some problems with threads. I understand how they work, but since they all use the same method, how do I run different threads that do completely different things, but at the same time? To me, it seems that they always use the same standard method which makes them do the same thing. So, let's say I have a big .txt file ...

Closing thread using ExitThread - C

I have a simple program that creates a thread, loops twenty times and then makes a call to close itself and perform the necessary cleanup. When I debug the program it reaches the ExitThread(); method and pauses, ignoring the printf(); I have set up after it to signal to me it's closed. Is this normal or am I forgetting to do something?...

vb.net waiting for webservice for lookup on import in silverlight mvvm.

Hello all I have a problem, I am writing an import CSV to silverlight MVVM the problem I am having is I loop the lines of the stream and then add them to an array, 2 items in the array need to be looked up for the ID I can do that but the problem is they run on a different thread how do I wait for that to return its results and then proc...

Segfault in multithreaded python extension in C

I have a very trimmed down example that creates a segfault that I can't seem to get rid of. Python script calls a C function in an extension, which creates a new thread using pthreads. I use PyGILState_Ensure and PyGILState_Release around my python call (PyRun_SimpleString) in the new thread, but perhaps I'm not using them correctly or...

How the simples GUI countdown is supposed to work?

I am trying to write the simples GUI countdown. I found in Internet some code but it is already too fancy for me. I am trying to keep it as simple as possible. So, I just want to have a window saying "You have 10 second left". The number of second should decrease every second from 10 to 0. I wrote a code. And I think I am close to the wo...

Java marshaller performance

Hi, I've used JAXB Marshaller as well as my own marshaller for marshalling pure java bean objects into XML. It has been observed that both of them require almost same time to marshal. The performance is not acceptable and needs to be improved. What are possible ways where we can improve performance of marshaller? Like threading? ...

wpf exit thread automatically when application closes

Hi, I have a main wpf window and one of its controls is a user control that I have created. this user control is an analog clock and contains a thread that update hour, minute and second hands. Initially it wasn't a thread, it was a timer event that updated the hour, minutes and seconds but I have changed it to a thread because the appli...

Do perl threads have the same advantage as kernel threads?

Kernel threads do context switch at kernel level instead of process level. I am planning to set up an httpserver in perl. I want to know if perl threads have same advantage as kernel threads from the perspective of context switch. ...