multithreading

Does ScheduledThreadPoolExecutor tie a thread to a task when it is scheduled?

Hi, I'm trying to understand if the ScheduledThreadPoolExecutor class "ties" a thread to a task when it is only scheduled or only during its run?(of course that when it's finished there is no relation).You can see in the link supplied that schedule(..) calls delayedExecute(...) which is ok but then delayedExecute calls prestartCoreThread...

[OpenSSL] pthread_create failed and returned -1 (or 4294967295)

Hi experts, I'm trying to reproduce an example from Network Security with OpenSSL (by Chandra et al). The program consists of client.c server.c common.h and common.c. client.c simply creates a connection to the server on port 6012 and reads data from stdin and then send those data to the server. The server.c reads data from socket and w...

Does NSURLConnection block the main thread?

I'm using NSURLConnection in an iPhone application and the interface seems to slow down after sending initWithRequest: to my NSURLConnection instance. I'm not sure if this is occurring because my processing code is taking a long time to handle the response, or if it's because NSURLConnection is blocking the main thread. Can anyone conf...

When several threads are blocked on a lock, in what order do they resume running?

Threads A, B, C in that order, reach synchronized method f() in a single object. All have the same priority. B and C are blocked. A leaves f(). What thread now begins running in f()? Is it always B on the principle of FIFO? Or is the order undetermined? If C has a higher priority than B, does that guarantee that C will run rather t...

iPhone: NSFetchedResultsController with delegate and data update from a separate thread

Hi all! First of all, sorry for the too long question. I know that there are few questions here that discuss similar issues but none of these talks about NSFetchedResultsController with delegate together with update in separate thread. And none of the solutions has helped me. These are the existing questions: NSFetchedResultsControll...

Binding a WPF RichTextBox to a styled XML document, on-the-fly.

Alright, so, here is the scenario: I am outputting the result of a console app (in my case, MSBuild) and it has colors. I want to use those colors, or at least some colors, in a RichTextBox on my WPF page. I successfully have it routing the output to the RTB and it works great by adding new inlines. It's fast and efficient. The problem...

How many threads can be managed in Java 1.7?

How many threads about Java 1.7 are capable of managing? In Server/Client Web Program wich clients can login To Server. This Login is statefull. Clients > 3000 per Server ...

Thread-Safe implementation of an object that deletes itself

I have an object that is called from two different threads and after it was called by both it destroys itself by "delete this". How do I implement this thread-safe? Thread-safe means that the object never destroys itself exactly one time (it must destroys itself after the second callback). I created some example code: class IThreadCal...

Threads and Synchronization

I have a little difficulty in understanding the concept of private locks: public class MyObject { private final Object lock = new Object(); // private final lock object public void mymethod() { synchronized (lock) { // Locks on the private Object // ... } } } In the code above, lock is acquired on a different obje...

Is Socket ReceiveFromAsync implicltly multi threaded?

I'm currently working on a high performance Raw socket application. I'm using ReceiveFromAsync to receive packets. This may sound like a silly question, but is this implicitly threaded? I'm not sure if i need to take the received packet and thread off the handling to ensure I'm not blocking any additional packets while i handle the curr...

Identify processor (core) is used by specific thread

Hello, World! I would like to know if it is possible to identify physical processor (core) is used by thread with specific thread-id? For example, I have an multithreaded application that has 2 threads (threadid = 10 and threadid = 20, for instance). I run the application on a system that has a dual core processor (core 1 and core 2)....

How to design multithreaded application

I have a multithreaded application. Each module is executed in a separate thread. Modules are: - network module - used to receive/send data from network - parser module - encode/decode network data to internal presentation - 2 application module - perform some application logic on the above data one after other - counter module - used t...

Java: Is `while (true) { ... }` loop in a thread bad? What's the alternative?

Is while (true) { ... } loop in threads bad? What's the alternative? Update; what I'm trying to to... I have ~10,000 threads, each consuming messages from their private queues. I have one thread that's producing messages one by one and putting them in the correct consumer's queue. Each consumer thread loops indefinitely, checking for a...

.Net why does Threading.Task.Task still block my UI?

Hi all, I'm currently writing an application that will control positioning of a measurement device. Because of the hardware involved I need to poll for the current position value constantly while running the electric motor. I'm trying to build the class responsible for this so that it does the polling on a background thread and will rai...

Managing concurrent reads from a single Socket in a .Net application

I am writing a multi-threaded .Net application in which many callers need to concurrently read from a single Socket. Data read from the socket is split into records / chunks of data - each record is targetted at a specific caller identified by a CallerID in the header, so for example the stream of bytes read from the socket might be som...

python function fails to return unless the last statement is slow

I'm working on a subclass of threading.Thread which allows its methods to be called and run in the thread represented by the object that they are called on as opposed to the usual behavior. I do this by using decorators on the target method that place the call to the method in a collections.deque and using the run method to process the d...

what are the meanings of apple xcode threads when debuging an iphone application?

when I debug an iphone application, xcode launch 4 threads, such as thread 1,thread 2 ,thread 3 and thread 4.is anyone knows the usage of these threads? ...

Monitor.TryEnter Advice

Hello, We are using Parallel Extensions in one part of our vb.net app to retrieve an datatable from a dictonary(of string, datatable). In the method to retrive the table, we are using Monitor.TryEnter. Sometimes, we get the error "Object synchronization method was called from an unsynchronized block of code." Here is what our method lo...

what does WAKEUP really mean in the notify/notifyall context ?

some comments here have confused me! I thought I knew this and god knows I've written a ton of MT code, but its been a while and so.... FWIK notify/notifyall notify: one thread is selected from the waitset and moved to the entryset to acquire monitor lock notifyall : all threads are "notified" - are they all moved to the entryset ? ...

Accessing std::list from one or more thread

Hi All I need to access(only read) the data in std::list from one or more threads running in my application. This list will be created only once at time of booting an application and after all this list will be reading from muliple threads...say I will be doing this for (std::list <iterator>iii=list->begin();ii!=list->end();ii++) ...