multithreading

The calling thread cannot access this object because a different thread owns it

hello all i have a problem whenever i Refresh the prograss bar i get the error The calling thread cannot access this object because a different thread owns it how can i remove it shashank backgroundWorker12 = new BackgroundWorker(); timer1.Enabled = true; //cancel any async processes running for the background worker ...

How to lock a setter property for a thread.

I am running four threads that gets and sets the same property. When i uses breakpoint then it gives me result as expected but when i runs it directly it gives me last updated result. Here is my code int Port { get; set; } Thread[] tMain= new Thread[4]; public void btnListen_Click(object sender, EventArgs e) { for...

C++ books on multithreading

Possible Duplicate: Threading books for C++ Are there any good C++ books that deal extensively with multithreading and synchronization? I've had a quick look at Windows via C/C++, which may be good, but you may know other better ones. Thanks. Edit - Some books that have been suggested by others or that I found to be good: ...

"Thread already started" when resuming the activity

Hi all. Here is my situation: I am building a game for android and my game's activity is composed of a custom surfaceView which has a thread for the game logic and rendering. The architecture is similar to the LunarLander demo from Google's website. When the activity starts it creates the surfaceView and calls this method: @Overr...

SQL Server Deadlock Problem - How to Resolve ?

Hi All We have a SQL Job (2005) that from time to time will fail due a deadlock. The error is as follows ; Transaction (Process ID 52) was deadlocked on thread | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001] (Error 1205). The step failed. This i...

Want to send mail after specific time in Java

Hi Guys I want to send mail after specific time Actually I want to send mail after 23 hour from the specific date Now I am using java.util.TimerTask Thread to call that email function Please help me.. Thanks ...

What is a good ratio of Java threads to CPUs on Solaris?

I have a Java application that has a fixed thread pool of fifteen, the machine, Solaris 10 SPARC, has sixteen CPUs. Adding the pool has greatly increased performance, but I'm wondering if I have too many threads in the pool. Would performance be better with less threads or does Solaris do a good job of thread scheduling. Say the pool is...

Pausing a Thread - Activity pause timeout for HistoryRecord

I'm trying to write a game engine in Android, but I don't have much familiarity with threads. My thread has an attribute, mSurfaceHolder, which holds the surface that I'll be drawing to. The run() method for my thread looks like this: public void run() { // We're running now setState(STATE_RUNNING); // Keep looping while t...

how to access shared resource between 2 threads?

In one of Outlook add in, I have a worker thread that does some processing and then updates a boolean flag. Main thread checks this flag and if this is false , it just process a while loop and does nothing. //worker thread void DoSoneThing() { Outlook.Recipients recps = mail.Recipients. foreach(Outlook.Recipient recp in recps) { //Sa...

Why isn't this thread reading all data from the pipe consistently?

Anything wrong with this in general? CallingFunction() { CreatePipe() CreateMutex() CreateThread( ThreadFunction ) while(there is data left to send) { WriteFile(send data in 256 byte chunks) } WaitForSingleobject() //don't return until ReadThread is done return 0; } ThreadFunction() { WaitForSinglOb...

ThreadPool - WaitAll 64 Handle Limit

I am trying to bypass the the wait64 handle limit that .net 3.5 imposes I have seen this thread : http://stackoverflow.com/questions/2702545/workaround-for-the-waithandle-waitall-64-handle-limit So I understand the general idea but I am having difficulty because I am not using a delegate but rather I am basically working of this exam...

Trace a deadlock in Ruby

I use BrB to share a datasource for various worker processes in Ruby 1.9 that I fork with Process#fork like the following: Thread.abort_on_exception = true fork do puts "Initializing data source process... (PID: #{Process.pid})" data = DataSource.new(files) BrB::Service.start_service(:object => data, :verbose => false, :host => ...

Controlling the work of worker threads via the main thread...

Hey I am not sure if this has already been asked that way. (I didn´t find anwsers to this specific questions, at least). But: I have a program, which - at startup - creates an Login-window in a new UI-Thread. In this window the user can enter data which has to be verified by an server. Because the window shall still be responsive to th...

How to detect Swing thread policy violations

I am looking for an automatic way to detect violations of the Swing's single threaded policy in my code. I'm looking for something along the lines of some AOP code you drop into the VM while the swing app is running and have it log any places where a swing component is modified outside of the EDT. I'm not an AOP guy but I would imagine...

Python IDLE compatible with multithreading?

It seems that IDLE (part of the standard Python Windows install) will not execute multithreaded programs correctly without nasty hangs or bugout crashes. Does anyone know of a way to fix this? The following program will always hang in IDLE but complete normally when executed with the Python interpreter directly: import threading, time...

Need to synchronize setting of boolean member vars?

Hey all, I'm working on some code I inherited, it looks like one thread is setting a boolean member variable while another thread is in a while loop checking it. Will this actually work OK or should I change it to use synchronized getters or setters on the boolean var? ...

ui task not acting as expected

In the code below, I would like to display a status message while fetching some data before and not display a dialog populated with that data until the data fetch is complete. But the dialog is instead being displayed before the data gets there. What am I doing wrong? Cheers, Berryl ProjectSelectionViewModel vm = null; SetStatus("Fetc...

Does Events in java are treated in a separated thread or I have to do it myself?

Im pretty new to programming....so I am making a music Player that needs some features I need to treat one Event at the same time in 2 classes. For example... The Player is plaing music on its own thread, when this music is done, it fires musicFinished(MusicEvent), go to the Playlist class and asksForAnotherMusicToPlay(), then starts pl...

Why would I want to start a thread "suspended"?

The Windows and Solaris thread APIs both allow a thread to be created in a "suspended" state. The thread only actually starts when it is later "resumed". I'm used to POSIX threads which don't have this concept, and I'm struggling to understand the motivation for it. Can anyone suggest why it would be useful to create a "suspended" thread...

Techniques for debugging a race condition in Silverlight

I've hit against what I think is a race condition. What options do I have to debug it? More details: I have a Silverlight application which uses Telerik grid. The columns can be customised by the user by using a column chooser attached to the grid. In a particular case where the list of possible columns are created via the code, when I ...