multithreading

Why are functional languages considered a boon for multi threaded environments?

Possible Duplicate: Functional programming and multicore architecture I hear a lot about functional languages, and how they scale well because there is no state around a function; and therefore that function can be massively parallelized. However, this makes little sense to me because almost all real-world practical programs ...

C# threads - Posting messages between threads

Hi All, I am working on a project which involves reusing as well as migrating some of the existing MFC code to C#. The current code in MFC, creates some threads and uses ::PostthreadeMessage() and ON_THREAD_MESSAGE(msg,func) for inter thread asynchronous communication through messages. ::PostthreadeMessage() -> sends a message to a pa...

Thread processing in EMS connection

I am setting up a client and exchange project and both are connecting to a remote server. Exchange will connect to the server by EMS connection. While client will connect by FIX. For the aim of building of black box testing, both client and exchange engine will be given some predefined testcases to send and receive to the server. I des...

implement multithreading

how to to implement multithreading where one thread updating UI and other one is reading the database record in windows application Any guidelines really appreciated... ...

Python : How to close a UDP socket while is waiting for data in recv ?

Hello, let's consider this code in python: import socket import threading import sys import select class UDPServer: def __init__(self): self.s=None self.t=None def start(self,port=8888): if not self.s: self.s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM) self.s.bind(("",port))...

Thread safety in Singleton

I understand that double locking in Java is broken, so what are the best ways to make Singletons Thread Safe in Java? The first thing that springs to my mind is: class Singleton{ private static Singleton instance; private Singleton(){} public static synchronized Singleton getInstance(){ if(instance == null) instan...

Implement a multithreading environment

I want to implement a multithreading environment using Qt4. The idea is as follows in c++-alike pseudo-code: class Thread : public QThread { QList<SubThread*> threads_; public: void run() { foreach(SubThread* thread : threads) { thread.start(); } foreach(SubThread* thread : threads) { ...

ajax multi-threaded

Can do use ajax to achieve true multi-threaded?if can ,how to do? please give me some related information,web site or books. thanks ~! ...

How to simulate different CPU frequency and limit RAM

Hi I have to build a simulator with C#. This simulator should be able to run a second thread with configureable CPU speed and limited RAM size, e.g. 144MHz and 50 MB. Of course I know that a simulator can never be as accurate as the real hardware. But I try to get almost similar performance. At the moment I'm thinking about creating a th...

Protecting critical sections based on a condition in C#

Hello, I'm dealing with a courious scenario. I'm using EntityFramework to save (insert/update) into a SQL database in a multithreaded environment. The problem is i need to access database to see whether a register with a particular key has been already created in order to set a field value (executing) or it's new to set a different val...

How do I abort a socket.recv() from another thread in python?

I have a main thread that waits for connection. It spawns client threads that will echo the response from the client (telnet in this case). But say that I want to close down all sockets and all threads after some time, like after 1 connection. How would I do? If I do clientSocket.close() from the main thread, it won't stop doing the recv...

Threads in Java

I've created simple program to test Threads in Java. I'd like it to print me numbers infinitely, like 123123123123123. Dunno why, but currently it stops after one cycle finishing 213 only. Anyone knows why ? public class Main { int number; public Main(int number){ } public static void main(String[] args) { new ...

OpenMP num_threads(1) executes faster than no OpenMP

I’ve run my code in a variety of circumstances which has resulted in what I believe to be odd behavior. My testing was on a dual core intel xeon processor with HT. No OpenMP '#pragma' statement, total runtime = 507 seconds With OpenMP '#pragma' statement specifying 1 core, total runtime = 117 seconds With OpenMP '#pragma' statement sp...

Creating Thread in Win32

Does ThreadFunc() gets called two times here? sometimes I notice a single call and sometimes none at all. #include <windows.h> #include <stdio.h> DWORD WINAPI ThreadFunc(LPVOID); int main() { HANDLE hThread; DWORD threadld; hThread = CreateThread(NULL, 0, ThreadFunc, 0, 0, &threadld ); printf("Thread is running\n"); }...

For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue?

For single-producer, single-consumer should I use a BlockingCollection or a ConcurrentQueue? Concerns: My goal is to pull up to 100 items at a time and send them as a batch to the next step. If I use a ConcurrentQueue, I have to manually cause it to go asleep when there is no work to be done. Otherwise I waste CPU cycles on spinning. ...

Binding across multiple DispatcherObjects

Here is a really tricky scenario I have been confronted with. I have a static helper class that contains some dependency properties used as binding sources. My main Window binds to these properties to determine some visual aspects. Recently we have added the ability to measure the progress of long-running operations with a progress bar w...

Is it safe to draw three separate QImages in three separate QThreads?

I have a QMainWindow with three widgets inside that are promoted to a class containing a subclassed QThread. They each draw on a local QImage in their rexpective qthread which is sent with a signal once its drawn and then rendered by calling update (mandlebrot example) from the slot. Is this safe or dangerous? They do not share any data...

Noise with multi-threaded raytracer

This is my first multi-threaded implementation, so it's probably a beginners mistake. The threads handle the rendering of every second row of pixels (so all rendering is handled within each thread). The problem persists if the threads render the upper and lower parts of the screen respectively. Both threads read from the same variables,...

How to tell which thread(s) are producing all the garbage?

I have an app with about 15 threads. Most do mundane tasks and sleep most of their lives. Others collect information and cache it in hashmaps. The hashmaps grow to a moderate size and level out. The number of keys and size of value remains constant, but the contents of the values changes (at 33 keys per second average). When I start my ...

Basic QT Event handling / Threading questions ?

Greetings , I am new to QT (4.6) and have some basic questions regarding its event mechanism.I come from Swing background so I am trying to compare it with QT. 1) Does Event-processing-loop run in seperate thread? (like EventDispatch thread in Swing) ? 2) If we open several 'QMainWindow' do they run in several threads? 3) Whats the be...