multithreading

Reasons for NSManagedObjectMergeError error on [NSManagedObjectContext save:]

I have a application that combines threading and CoreData. I and using one global NSPersistentStoreCoordinator and a main NSManagedObjectContextModel. I have a process where I have to download 9 files simultaneously, so I created an object to handle the download (each individual download has its own object) and save it to the persisten...

boost thread, test if thread is ready to join

hi. I would like to know if there is a way to test whenever thread finished execution and is waiting for joining. My guess was the use time_join. is there explicit way to test it? ...

The calling thread must be STA, because many UI components require this error In WPF?

Hi. I make pop-up message for my application. this form is on wpf, and in the a thread i check a value and for some result , I show that pop-up to show message. In the thread when I create pop-up class(type of WPF window class) an error throw by pop-up Contractor. "The calling thread must be STA, because many UI components require this...

VB.NET code for running multiple threads

How to I run multiple threads in VB.NET? Say I need 2 threads - one that prints 100 numbers in a loop and the second one that asks for the user's name and prints it inside a message box. ...

When using newCachedThreadPool how do I get the current number of threads

I'd like to log the number of active threads created by a newCachedThreadPool call. I can't seem to find out where to get this value though. ...

How to tell if there is an available thread in a thread pool in java

I am trying to proccess a queue of tasks from a database table as fast as possible while also limiting the number of threads to process the tasks. I am using a fixed sized thread pool with Executors.newFixedThreadPool(N); I want to know if there is a way of knowing if the thread pool is full, by that I mean are there currently 50 thre...

Passing parameter to pthread

Hello, i have the following code: #include <stdlib.h> #include <stdio.h> #include <pthread.h> #define NUM_THREADS 100 struct thread_param { char *f1; char *f2; int x; }; void *thread_function(void *arg){ printf("%d\n", ((struct thread_param*)arg)->x); } int main(int argc, char *argvs[]){ int i, thread_cr_res = 0,...

Is correct order of WCF TCP messages guaranteed for multiple sending threads?

There is a single WCF connection using TCP. Two threads on the server write to this connection consecutively. Is it always guaranteed that the first message gets processed by the client first? According to my understanding it should be guaranteed. ...

cuda device selection with multiple cpu threads.

Hello. Can you tell me how cuda runtime chooses GPU device if 2 or more host threads use cuda runtime? does the runtime choose separate GPU devices for each thread? does GPU device needs to be set explicitly? Thanks ...

Painting on GtkScrolledWindow or GtkEventBox

Using GTK, I'm trying to overlay a "More" prompt (but it could just as well be any drawing object) in the corner of a GtkTextView contained within a GtkScrolledWindow. I draw the prompt in the handler for the expose signal of the text view. It works, but when I scroll the window I get artifacts: the prompt is moved along with the content...

C++ boost thread reusing threads

hi. I am trying to accomplish something like this: thread t; // create/initialize thread t.launch(); // launch thread. t.wait(); // wait t.launch(); // relaunch the same thread How to go about implementing something like this using boost threads? in essence, I need persistent relaunch-able thread. I would like to avoid work queue, a...

BSoD when creating threads

I am trying to create +5 threads synchronously so there shouldn't be any concurrency error. Code: System.Threading.Thread t = new System.Threading.Thread(proc); t.Start();//==t.BlueScreen(); t.Join(); Is darkness a feature ? I am doing something wrong? OS:Microsoft windows vista(unfortunately) x64 Language:C# 3.0|4.0 .Net version:3...

Pipe data from InputStream to OutputStream in Java

Dear all, I'd like to send a file contained in a ZIP archive unzipped to an external program for further decoding and to read the result back into Java. ZipInputStream zis = new ZipInputStream(new FileInputStream(ZIPPATH)); Process decoder = new ProcessBuilder(DECODER).start(); ??? BufferedReader br = new BufferedReader(new InputStream...

Help regarding C# thread pool

I have a method that gets called quite often, with text coming in as a parameter.. I'm looking at creating a thread pool that checks the line of text, and performs actions based on that.. Can someone help me out with the basics behind creating the thread pool and firing off new threads please? This is so damn confusing.. ...

How to spawn thread in C#

Could anyone please give a sample or any link that describes how to spawn thread where each will do different work at the same time. Suppose I have job1 and job2. I want to run both the jobs simultaneously. I need those jobs to get executeded parallely. how can I do that ? Thanks ...

iphone - memory leaks in separate thread

I create a second thread to call a method that downloads several images using: [NSThread detachNewThreadSelector:@selector(downloadImages) toTarget:self withObject:nil]; It works fine but I get a long list of leaks in the log similar to: 2010-04-18 00:48:12.287 FS Companion[11074:650f] * _NSAutoreleaseNoPool(): Object 0xbec2640 of cl...

CAsyncSocket and ThreadPool problem

I have a server application with such structure: There is one object, call him Server, that in endless cycle listens and accepts connections. I have descendant class from CAsyncSocket, that has overriden event OnReceive, call him ProxySocket. Also I have a thread pool with early created threads. When connection is received by server obj...

Managed c++ cross threading

I got a thread: static void TestThread(System::Object ^obj) { Bot ^ob = (Bot^) obj; while( ob->Threads[0]->IsAlive ){ ob->textBox->text = "test"; // Cross threading error... Thread::Sleep(100); } } Dont know what to do i read about InvokeRequired and Invoke but didnt understand it.. Please...

Making global static variables multithread safe

I have global static variables in a C library, which generate exceptions in a multithread run. I need to make them safe in some way (i.e., each thread should relate to a different instance of these variables). Any recommended methods? ...

WPF Get gui Dispatcher

Is there any way to get the gui thread dispatcher when you have no reference to any elements.. ...