multithreading

Visual C#, Child Thread halts processing on parent thread. Why?

I am using Visual C# .Net via Visual Studio 2008 Express and I am launching a thread from a forms applications to wait on incoming data in a loop. So, each loop waits till data is available, then gets the data, and starts again waiting. The main reason why I'm waiting for my data in a separate thread is so my form will still allow inter...

Confine A Custom Thread to a Class instead of other classes

using System; using System.Text; using System.Threading; namespace Functionality_Threading { class Program { static void Main(string[] args) { TestA testFunction = new TestA(); testFunction.EventHandle += new TestA.EventHandlerMain(testFunction_EventHandle); var newThread = new...

Threads and delegates - I dont fully understand their relations.

I wrote a code that looks somewhat like this: Thread t = new Thread(() => createSomething(dt, start, finish) ); t.Start(); and it works (sometimes it almost feel like there are multiple threads) yet I don't use any delegates. What is the meaning of a tread without a delegate If a delegate is necessary - then please tell me what and...

Thread deadlock in J2EE application

I am a newbie to J2EE. I wonder if there are some common deadlock cases in J2EE application layer, resulting from using Java synchronization primitive - synchronized keyword. If yes, could help give an example? Thanks a lot! ...

C# Multithreading

Okay. I want to have two threads running. Current code: public void foo() { lock(this) { while (stopThreads == false) { foreach (var acc in myList) { // process some stuff } ...

Why is only the UI thread allowed to modify the UI?

I know that if I am modifying a control from a different thread, I should take care because WinForms and WPF don't allow modifying control's state from other threads. Why is this restriction in place? If I can write thread-safe code, I should be able to modify control state safely. Then why is this restriction present? ...

Waiting for WebBrowser ajax content

I want to pause the execution of my thread until a particular div has been loaded via ajax into a WebBrowser instance. Obviously I can continuously check for the presence of this div doing something like: while (Browser.Document.GetElementById("divid") == null) { Thread.Sleep(200); } However, sleeping the thread that the Browser is in...

ASP.NET MVC Multithreading

Hi everyone, I want to implement such logic in my asp-net-mvc application: user clicks a button -> server executes some time-consuming logic in ~15 threads (i get data from really slow independent sources) -> when all work is done, server merges the results and passes it back to user The other day i've seen an article which explain...

Does thread-local mean thread safe?

Specifically I'm talking about Python. I'm trying to hack something (just a little) by seeing an object's value without ever passing it in, and I'm wondering if it is thread safe to use thread local to do that. Also, how do you even go about doing such a thing? ...

What's the best way to signal threads that sleep or block to stop?

I've got a service that I need to shut down and update. I'm having difficulties with this in two different cases: I have some threads that sleep for large amounts of time. Obviously I can't wait for them to wake up to finish shutting down the service. I had a thought to use an AutoResetEvent that gets set by some controller thread when...

ProgressDialog dismiss() function does not work !

It works great on emulator but when i try it on Samsung Galaxy S, ProgressDialog keeps showing untill to force close the application. @Override public void onCreate(Bundle savedInstanceState) { . . . pd = ProgressDialog.show(this, "Working..", "Searching for words !",...

Getting user input in C++ without halting the program

Hi, I have a C++ program that captures videos, and I would like to be able create a command-line program to update its frame rate, image format, etc on the fly. How can I do this without halting the entire program? I need it to be able to wait for user input, but still capture videos at the same time. I know this will probably involve...

C# - Possible to safely have an owned form in a separate thread?

I am attempting to write a specialized onscreen keyboard (OSK) for an application I'm writing in C#. To facilitate this, I've created a form which has several buttons on it representing keys, and clicking them calls SendKeys and sends out the appropriate keys. This form is owned by the main window that is shown when the application firs...

Effect of IsBackground on .Net Threads?

I know that when the main method is running and the only other threads that are running are background threads then the application exits. Other than delaying program termination or not, does a backgrounded thread do anything differently or respond differently than a non-backgrounded thread? ...

How does linq lambdas work inside a loop?

I'm trying to implement Tasks im my Application. Here's a sample code: There's one simple Interface I, 3 classes are derived form it (A,B,C) I create a list of Is, poplualte it with A, B, C instances, and then create a tasf for each other to call method do1(); interface I { void do1(); } class A : I { ...

How to make a thread sleep for specific amount of time in java?

I have a scenario where i want a thread to sleep for specific amount of time. Code: public void run(){ try{ //do something Thread.sleep(3000); //do something after waking up }catch(InterruptedException e){ // interrupted exception hit before the sleep time is ...

Building a controlled java threading queue

Here is my situation. I have to run X searches (between 10-200) getting the results of each and appending them. I want to add some concurrency to the searches but I want to be able to throttle it. What I mean is I dont want to kick of 200 threads and wait for all to complete. I want to kickoff N threads and as each one completes star...

Interprocess communication on UNIX

Hi all, I have to implement some mechanism in C on SOLARIS 9 SPARC in order to allow interprocess communication. In a nutshell, i have to implement a multithread program where the father of the thread once receive a signal, or whatever you want, has to trigger a set of thread that are in charge of encrypting files. I cannot use some T...

Asynchronous WebRequests using C#

Hi i have a function that passes url Get parameters to a php file on a webserver and waits for a response from the file (normally takes 10-20 seconds). I want to put this inside a loop because I have to send these Get requests to about 5 different php files at once but when i try to add it to a loop the function makes the loop wait until...

iPhone UIActivityIndicator threaded help!

I'm looking to create a generic thread in my main delegate that I can use to display a UIActivityIndicator. I have several views that push new views onto the stack. Most of the views are called from the didSelectRow method in the calling view. When they select a row in a UITableView, I want to start the Activity Indicator and push the ne...