multithreading

Multithreading in .NET 4.0 and performance

I've been toying around with the Parallel library in .NET 4.0. Recently, I developed a custom ORM for some unusual read/write operations one of our large systems has to use. This allows me to decorate an object with attributes and have reflection figure out what columns it has to pull from the database, as well as what XML it has to outp...

Display image in second thread, OpenCV?

I have a loop to take in images from a high speed framegrabbger at 250fps. /** Loop processes 250 video frames per second **/ while(1){ AcquireFrame(); DoProcessing(); TakeAction(); } At the same time, I would like the user to be able to monitor what is going on. The user only needs to see images at around 30 fps (or less). Ho...

Does Linux drop into the kernel on all cores?

Hi: For a multi-core computer running Linux 2.6.x, what happens when a thread makes a system call? Does it drop into the kernel only on the core that the thread is running on, or does it drop into the kernel on all cores (sorry if this is a newbie question). Is this behaviour (whichever is the correct one) the same when receiving inte...

How can I locate a process' global and stack areas in Win32?

How can I locate which areas of memory of a Win32 process contain the global data and the stack data for each thread? ...

Why doesn't this java program constructor go on infinitely?

Looking at some code, learing about threads: import java.applet.*; import java.awt.*; public class CounterThread extends Applet implements Runnable { Thread t; int Count; public void init() { Count=0; t=new Thread(this); t.start(); } public boolean mouseDown(Event e,int x, int y) { t.stop(); return true; } pu...

IllegalMonitorStateException

What can cause that i get IllegalMonitorStateException in this code synchronized(syncCount){ syncCount--; syncCount.notify(); } I'm little confused, since, as far as I know running thread must have monitor on object who's notify is called. It looks to me that my code can not be wrong, but somehow it is. ...

Separate dbx connection to a thread

I made a small app that connects to a mysql db using dbx. It works ok with my local mysql server, but it's supposed to work with a remote server. Connecting to the remote server takes a few seconds, which freezes the app. So my question is, how can I put the connection code in a different thread? I'll have to pass that connection to t...

ASP.NET Threading Issue

Problem: I am working on a ASP.NET 2.0/C# Application and I need to do the following: I have a function I am using from a third-party library lets say MyFunctions.CalculateTotal(int a, int b); A known issue is that the thread locks resources. So there is another function that needs to be called afterwards to clean everything up. M...

.net System.Threading.Timer needs to access Silverlight 3 UI component in callback

I have a Silverlight 3 page. I use a System.Threading.Timer to perform an Asynchronous WCF service call. I make the call by passing in the Silverlight page class ("this") in as the "state" object in the timer constructor, and accessing the service client proxy through it. By doing it this way, the callback from the WCF service fires f...

Threading in a django app

I'm trying to create what I call a scrobbler. The task is to read a Delicious user from a queue, fetch all of their bookmarks and put them in the bookmarks queue. Then something should go through that queue, do some parsing and then store the data in a database. This obviously calls for threading because most of the time is spent waitin...

GNOME applet using threads hangs

I am trying to develop a GNOME applet (put into panel) using python (pyGTK). I've started by following the tutorial suggested in other SO question. My plan is to let the applet do something in the background in a repetitive fashion (causing its display to be updated). So I thought I am gonna need threads to do it. I've seen several tut...

Is this a safe version of double-checked locking?

Here's an idea I just came up with for a safe, efficient way of handling Singleton synchronization issues. It's basically double-checked locking, but with a twist that involves thread-local storage. In Java/C#/D-style pseudocode, assuming __thread denotes thread-local storage for static variables: class MySingleton { __thread stat...

which language is better for packet capturing and processing

I want to write a program that has 2 threads , one thread continuously captures packets from the network and dumps them in a buffer every t seconds and the other thread continuously reads this buffer and processes it every t seconds.. Can this be done in C ? or will Java be a better option ? ...

Network problem!(multithreaded client/server)

Hi, this is my Main class which belongs to the server application! but it is really surprizing that without running the client application,these sentences will be written in the console.would you please help me why?thanks. my Main class: public class Main { static Socket client = null; static ServerSocket server = null; // We can hav...

How can I get a list with all the threads created by my application

Hi, I want to get a list with all the threads (except the main, GUI thread) from within my application in order to do some action(s) with them. (set priority, kill, pause etc.) How to do that? ...

Control.Invoke getting 'stuck' in hidden ShowDialog

(I have a workaround for this problem, but it's not the first time I've been bitten, so I'm trying to understand exactly what's going on.) From my application, I ShowDialog a form. On the form is a button, which when clicked calls code on another (non-Gui) thread. The non-GUI thread sends back statuses (Pushed then Released) via a Con...

Java Synchronized Block for .class

What does this java code means? Will it gain locks on all objects of 'MyClass' synchronized(MyClass.class) { //is all objects of MyClass are thread-safe now ?? } And how the above code different from this one: synchronized(this) { //is all objects of MyClass are thread-safe now ?? } ...

Delphi - Terminate blocked thread

Possible Duplicate: How to stop long executing threads gracefully? Hello. I have a background thread which needs to perform an operation, it works fine all of the time except in one case : when the resource is corrupted. When that happens the thread gets Blocked in the Load (to that resource) calls in the Execute method. When ...

Is there a way to get the stacktraces for all threads in c#, like java.lang.Thread.getAllStackTraces()?

In java it is possible to get a snapshot of the stacktraces of all running threads. This is done with java.lang.Thread.getAllStackTraces() (it returns Map<Thread,StackTraceElement[]>). How can the same thing be done with .net? ...

how to set a threadname in MacOSX

In Windows, it is possible to set the threadname via this code. The threadname is then shown in debuggers. Under Linux, see this question. In MacOSX, I have seen several hints which indicates that there are threadnames. I think the class NSThread also has a name-attribute. My goal is that I can set the threadname in my C++ application ...