multithreading

(iPhone) how to wait a method to finished up, one of its arguments is calling selector..

I'm stuck with this problem, looks like multithreading one but I'm quite new to this kind of topics. I need some help form experts!!! [Problem Conditions] (1) Need to call a method which has 3 arguments, one argument is "@selector( myMethod: )" (2) Need to call (1) for multiple times (3) Need to make sure each of (1)'s selector is don...

Cancel a timed loop in JavaScript?

I'm trying to setup a function in JavaScript to fade in or fade out some elements on my page. The fade themselves work fine, but my problem occurs when one of them tries to cancel the actions of the other one. //I know this is ugly, I'm just learning JavaScript again and plan to recode it after I learn some more... var fadeOut = false ...

2 threads access WCF service with default behaviour ConcurrencyMode = Single

I have a client that runs 2 threads, each of them try to access a wcf service. The service is defined using the default behavior of AppService = new ServiceHost(typeof(MyService), new Uri[] { new Uri(netTcpLocalhostSimple) }); AppService .AddServiceEndpoint( typeof(IMyServiceContract), ...

Thread for Windows form

When I'm creating a simple Windows form, is it starting in a new thread automatically? Or there is only one thread for all forms? ...

Are modern CPU caches optimized to deal with constant strides? Across threads?

Say I have a big array, and multiple threads reading from the array. Each thread iterates through the array by jumping a constant amount, but starts at a different offset. So thread 1 may start at element 0, then read elements 32, 64, 96, etc. But thread 2 starts at element 1, and read element 33, 65, 97, etc. (keeping in mind that an 'e...

Progress reporting from background task

I have a background task that imports files into a database. I want the user to see what is currently happening (collecting files/ importing files), which file is currently processed and how far the task has progressed. How can I do this in an easy way? The interaction between Model and Controller is so close, that I could almost put the...

Is a Python Queue needed for simple byte stream between threads?

I have a simple thread that grabs bytes from a Bluetooth RFCOMM (serial-port-like) socket and dumps them into a Queue.Queue (FIFO), which seems like the typical method to exchange data between threads. Works fine. Is this overkill though? Could I just use a bytearray then have my reader thread .append(somebyte) and the processing func...

Background worker help. VERY basic.

namespace BackgroundWorkerExample { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { Thread.Sleep(1000); MessageBox.Show("Now!"); } pr...

Multithreaded A* Search in Java or Lisp or C#

Is there a good way to do a multithreaded A* search? Single threaded is fairly easy, as given in (for example) Artificial Intelligence: A Modern Approach, but I have not come across a good multithreaded version. Assume a sane language like Java or C# or Lisp where we have thread pools and work blocks, and of course garbage collection. ...

Wiring threaded C# events in constructor

If a non-gui object constructor wires a local event handling method to the event field of an object on a different thread, is it possible for said event handling method to be called before the constructor is finished? Example: (semantic pseudocode only) public static B b = new B(); class A { public A() { b.evt += Event...

to create a worker thread and keep it alive throughout my application life time to perform some back ground tasks

I have a req where in i have to create a worker thread and keep it alive throughout my application life time to perform some back ground tasks . so is there any way i can stack tasks to this worker thread when ever needed by my application .? ...

Slowdown identified: ReaderWriterLock(-1). May I use different locks?

Hi, after hours of tracking mysterious one or two seconds long lasting "freeze" I finally found out that its ReaderWriterLock(-1). It is server app and the lock here is held for writing to client collection. Im not familiar with locking so I would like to ask if there is not any better/faster way? How about using lock object to lock add/...

How to execute application continuously without hangs device in blackberry.

Hi, I have created an application of contacts synchronization. when i run it on device it hangs my device while synchronizing then i am not able to open another application, I am also doing auto synchonization with in a perticular period of time. I want that synchronization should be perform without hang to device and if i get any in...

Problems Queuing Concurrent & Non-Concurrent NSOperations

Hi there, I have an NSOperationQueue which contains 2 NSOperations and is set to perform them one after another by setting setMaxConcurrentOperationCount to 1. One of the operations is a standard non-concurrent operation (just a main method) which synchronously retrieves some data from the web (on the separate operation thread of cours...

Throwing FaultException<T> from worker thread crashes WCF

What I found out was if you throw a FaultException from a new worker thread, it doesnt percolate up to the client but just crashes WCF. Any solutions??? example: var thread = new Thread(new ThreadStart( delegate { new Killbot().KillAllHumans(); // Throws a FaultException ...

What is a Condition Variable in java?

Q1. What is a condVar in Java? If I see the code below, does a condition variable necessarily have to be within the 'mutex.acquire()' and 'mutex.release()' block? public void put(Object x) throws InterruptedException { mutex.acquire(); try { while (count == array.length) notFull.await(); array[putPtr] = x; ...

How can I schedule a particular thread in Blackberry

Hello, I want to auto-schedule a thread with a particular time interval. I also need to execute this in the background continously without hangs to the device. I have tried this with Application Manager Class but it's for application scheduling and I need to schedule thread within the application. ...

Lock used in Cache Item callback and other method doesn't seem to lock

Simplest explanation I can produce: In my .NET1.1 web app I create a file on disc, in the Render method, and add an item to the Cache to expire within, say, a minute. I also have a callback method, to be called when the cache item expires, which deletes the file created by Render. In the Page_Init method I try to access the file which t...

How to illustrate multiple threads in sequence diagram?

How can you clearly illustrate multiple threads of execution in a sequence diagram or similar diagram? I haven't been able to find any clear examples. All diagrams I see are used to illustrate a single thread. Update: The accepted answer was the best example I saw but it does leave a fair bit to be desired. I ended up illustratin...

Will a request in IIS run on a single thread?

We have a system that runs in IIS. The system should always run using the same "culture", but we cannot rely on the server settings being set correct. One way to do it is to specify the culture everytime we do a ToString. However, we were wondering, is it possible to set the culture on a thread at the begining of a method and rely on ...