multithreading

Is it possible to store pointers in shared memory without using offsets?

When using shared memory, each process may mmap the shared region into a different area of its respective address space. This means that when storing pointers within the shared region, you need to store them as offsets of the start of the shared region. Unfortunately, this complicates use of atomic instructions (e.g. if you're trying to ...

How to pass more than one parameter to a C# thread?

How to pass more than one parameter to a C# thread? Any example will be appreciated. ...

Events raised by BackgroundWorker not executed on expected thread

A winforms dialog is using BackgroundWorker to perform some asynchronous operations with significant success. On occasion, the async process being run by the background worker will need to raise events to the winforms app for user response (a message that asks the user if they wish to cancel), the response of which captured in an CancelE...

Is I/O Completion ports(Windows) or Asynchronous I/O (AIO) will improve performance of multithreaded servers handling large volume of requests?

Hi, I want to use I/O Completion ports for Windows and Asynchronous I/O (AIO) for solaris and Linux versions of my server application. The application server is multithreaded and it can accept lot of concurrent TCP connections and can process many requests per conenction. Is this criteria well enough to use the latest AIO?. Is there any...

Using a JMS Session from different threads

From the javadoc for Session it states: A Session object is a single-threaded context for producing and consuming messages. So I understand that you shouldn't use a Session object from two different threads at the same time. What I'm unclear on is if you could use the Session object (or children such as a Queue) from a different th...

How to know if all the Thread Pool's thread are already done with its tasks?

I have this application that will recurse all folders in a given directory and look for PDF. If a PDF file is found, the application will count its pages using ITextSharp. I did this by using a thread to recursively scan all the folders for pdf, then if then PDF is found, this will be queued to the thread pool. The code looks like this: ...

How to use hardware threads in C# dot net code running on multicore machine ?

How to use hardware threads in C sharp code running on multi core machine ? Any example will be appreciated. I wish to run the two threads parallelly on two cores of my machine. If I create normal software threads in C sharp they may run on single core. Is it possible to run these two threads implicitly parallel on two cores so as to g...

Threads: Just what is it that makes them confusing? Two Runnables with Mouse Listener

I have a JWindow and a JFrame both I have made runnable and both implement a mouse listener. I have alot of testing to do for a project of mine and to simplify it I wish to be able to automate most of it, so I have starting my own mouse recorder and replayer (uses Java Robot Class). Kinda like a simplified AutoHotKey or AutoIt thing... ...

How a thread should close itself in Java?

This is a short question. At some point my thread understand that it should suicide. What is the best way to do it: Thread.currentThread().interrupt(); return; By the way, why in the first case we need to use currentThread? Is Thread does not refer to the current thread? ...

Java fatal error, don't know what it means

It happens at the same place in my code (albeit not the first time the method is executed) but I can't make head or tail of what is wrong. (Doubly so as it's code for a robot). Be most appreciative if someone can give me an idea of what kind of problem it is. I assume it's to do with threading (multi-threaded app) but I don't really kno...

c# CF Restart a thread

Hi all, Supose you have a form with a button that starts/stops a thread (NOT pausing or interrupting, I really need to stop the thread !) Check out this code: Constructor() { m_TestThread = new Thread(new ThreadStart(ButtonsThread)); m_bStopThread = false; } ButtonClick { // If the thread is not running, start it m_TestThread.S...

is it possible my threads are not being killed when the server is killed

A quartz scheduler is being used in an Application I am working on. A process that runs using the quartz scheduler spawns new threads. I was wondering if it is possible for these threads to continue living after the server is killed? ...

Can someone provide an easy explanation of how 'Full Fences' are implemented in .Net using Threading.MemoryBarrier?

I'm clear on the usage of MemoryBarrier, but not on what happens behind the scenes in the runtime. Can anyone give a good explanation of what goes on? ...

ReaderWriterLockSlim question.

There are lots written about the ReaderWriterLockSlim class which allows multiple read and a single write. All of these (at least that I had found) tell how to use it without much explanation why and how it works. The standard code sample is: lock.EnterUpgradeableReadLock(); try { if (test if write is required) { lock.Enter...

Multithreaded Unit Testing

Hi, Can anybody recommend any good books on unit testing for multitesting applications. Also can any body recommend appplications or utilities which can be used for multithreaded testing, similar to the java tool ConTest, (which i've not used but a fried recommended) Any help particularly related to C# unit testing for multithread...

.NET concurrency performance on the client side

I am writing a client-side .NET application which is expected to use a lot of threads. I was warned that .NET performance is very bad when it comes to concurrency. While I am not writing a real-time application, I want to make sure my application is scalable (i.e. allows many threads) and is somehow comparable to an equivalent C++ applic...

MySQL: Transactions across multiple threads

Preliminary: I have an application which maintains a thread pool of about 100 threads. Each thread can last about 1-30 seconds before a new task replaces it. When a thread ends, that thread will almost always will result in inserting 1-3 records into a table, this table is used by all of the threads. Right now, no transactional support...

What does flushing thread local memory to global memory mean?

Hi, I am aware that the purpose of volatile variables in Java is that writes to such variables are immediately visible to other threads. I am also aware that one of the effects of a synchronized block is to flush thread-local memory to global memory. I have never fully understood the references to 'thread-local' memory in this context....

Thread Message Loop Hangs in Delphi

Hello all. I have a simple Delphi program that I'm working on, in which I am attempting to use threading to separate the functionality of the program from its GUI, and to keep the GUI responsive during more lengthy tasks, etc. Basically, I have a 'controller' TThread, and a 'view' TForm. The view knows the controller's handle, which i...

Java: Stopping a thread that has run for too long?

Say I've got something like this public void run(){ Thread behaviourThread = new Thread(abstractBehaviours[i]); behaviourThread.start(); } And I want to wait until abstractBehaviours[i] run method has either finished or run for 5000 milliseconds. How do I do that? behaviourThread.join(5000) doesn't seem to do that afaik (somet...