multithreading

In Java 6, why doesn't higher priority thread not run even if lower priority thread yields?

In the code below, I am trying to get the higher priority thread to run by yielding the lower priority thread. But it doesn't seem to work, the higher priority thread seems to run after lower priority thread finishes. Can anyone explain what I am doing wrong? import java.util.ArrayList; import java.util.List; public class TestThreadPri...

about the call of CreateDIBSection in a thread

in a function named buildtexture, it loaded the image and build texture for OpenGL, when i called CreateDIBSection, it will creat a bitmap. If the function buildtexture was called as a normal member function, there will be nothing wrong. But if i called this member function in a thread, the CreateDIBSection will return 0 that means it f...

call of CreateDIBSection failed in a thread

in a function named buildtexture, it loaded the image and build texture for OpenGL, when i called CreateDIBSection, it will creat a bitmap. If the function buildtexture was called as a normal member function, there will be nothing wrong. But if i called this member function in a thread, the CreateDIBSection will return 0 that means it f...

Large number of simultaneous long-running operations in Qt

I have some long-running operations that number in the hundreds. At the moment they are each on their own thread. My main goal in using threads is not to speed these operations up. The more important thing in this case is that they appear to run simultaneously. I'm aware of cooperative multitasking and fibers. However, I'm trying to...

Multi-Threading Starting Time

I have a multi-threading code running on my asp.net app like follow: ... List<Thread> workers = new List<Thread>(); foreach (Airline airline in this._criteria.Airlines) { Task mytask = new Task(); Thread t = new Thread(new ThreadStart(mytask.Execute)); workers.Add(t); t.Start(); } //block all until finish foreach (var t...

Why is Control.Invoke necessary?

Control.Invoke executes the specified delegate on the thread that owns the control's underlying window handle. For years I have just accepted that this is the way it has to be, but I have never understood why. The only thing I can think of is that the code is terribly thread unsafe, and instead of just adding a little synchronization...

Django timer thread

Hello, I would like to compute some information in my Django application on regular basis. I need to select and insert data each second and want to use Django ORM. How can I do this? ...

Is it safe to use compiled linq queries in asp.net applications

I see a lot of posts of people using compiled Linq to Sql queries for high-demand asp.net applications. I've done some performance tests and in many cases compiled queries are better than the ordinary ones. What bothers me is that when using compiled queries the query is preserved in a static variable. In asp.net in many cases it is not ...

Dispatcher.Invoke hanging when ListCollectionView is monitoring Collection

My problem feels very similar to the issue mentioned in this post. Essentially, Invoke is hanging (only when run outside the debugger). I think it's due to nesting of Invoke calls. I'm using MVVM Light, and I've tried two implementations of a multi-thread friendly ObservableCollection - I've used this one for ages and recently tried t...

Adapt "push" design to "pull" with a thread

I have to work with some legacy code written in a "push" callback style. The architecture looks like this (pseudo-Java) public interface Callback { public void consumeData(Object data); } public class Worker // The legacy class { private Callback cb; public Worker(..., Callback cb) { this.cb = cb; ... ...

Recommendations for executing .NET HttpWebRequests in parallel in ASP.NET.

I have an ASP.NET MVC web application that makes REST style web service calls to other servers. I have a scenario where I am making two HttpWebRequest calls to two separate services. I need them both to complete to continue, but their order doesn't matter. They may take 1-2 seconds each and I am running them in sequence now. Running ...

Launch Application within an Thread, using Timer

Hi all, I'll try explain me as better possible, sorry my english. I have a Thread, within this thread I call method, which have long time process. The method has a foreach, and using counter for each iteration (counter++) I want to do this: a). Within foreach, if counter > 20: a1). Check if any proccess (which Name = "SendMailServi...

what is kernel thread dispatching?

Can someone give me an easy to understand definition of kernel thread dispatching or just thread dispatching if there's no difference between the two? From what I understand it's just doing a context switch while the currently active thread waits on a lock from another thread, so the CPU goes and does something else while this thread is...

Capturing program output.

i am making a small library that will basically capture the standard outputs of a program (such as printf()) into a separate process/thread...this process should then perform certain tasks (lets say write these captured outputs to a file)...i am just beginning to do serious C programming so i am still learning. i wanted to know what is ...

Connection Pool returns Same Exception Instance to Two Threads Using the Same Bad Connection String?

Ok this looks like a major fundamental bug in .NET: Consider the following simple program, which purposely tries to connect to a non-existent database: class Program { static void Main(string[] args) { Thread threadOne = new Thread(GetConnectionOne); Thread threadTwo = new Thread(GetConnectionTwo); ...

How can I get a list of all threads in a .Net application?

I'm trying to troubleshoot a larger multiprocessing issue -- I suspect a client library is creating a foreground thread, and I'm trying to see if that theory is correct. In order to do that, I'd like to be able to log a list of all threads in a process, what their state is, and whether they are background or foreground. I've seen Proce...

Inter-thread communication. How to send a signal to another thread

In my application I have two threads a "main thread" which is busy most of the time an "additional thread" which sends out some HTTP request and which blocks until it gets a response. However, the HTTP response can only be handled by the main thread, since it relies on it's thread-local-storage and on non-threadsafe functions. I'm l...

Why client thread is destroyed after it is executed only once? Java TCP sockets

I want my client class to run a thread that sends String information (order) to the server continuously every 5 sec. But instead thread is destroyed after it sends first order. I dont know why and how to stop it, can somebody help me? below code; public class Cashier implements Runnable { private static final int MAX_DELAY = 5000; ...

Thread dispatching - what is it?

Can someone give me a simple definition for kernel thread dispatching or just thread dispatching if there's any difference between the two? ...

Enforcing relationship between Managed Thread and OS Thread (CUDA usecase)

Problem I'm trying to create an CUDA application that is well integrated with .net. The design goal is to have several CUDA functions that can be called from managed code. Data should also be able to persist on a device between function calls, so that it can be passed to multiple CUDA functions. It is of importance that each individual...