multithreading

Access Android activity stack from asynchronous thread?

There are a ton of activity stack related questions on StackOverflow, but I didn't really see any that answered the question I have. I'm working on an online game that (for now) has 3 different activities: Login/Register Menu (seen when logged in, includes "new game", "my stats", and a few other things...I'm just worried about the "ne...

How do you think through and predict the output of a threading question like this?

I'm prepping for the SCJP, and multithreading has been my shakiest area, mostly because I don't know how to look at multithreading code and walk through it. So far my approach has been to write down in English what might be happening in each thread and testing a few cases with threads randomly intersecting each other, which is a really h...

Why does Google App Engine support a single thread of execution only?

Does anybody have an idea why Google App Engine permits only a single thread of execution for a deployed application? I personally believe that it has something to do with the predictability of an application so that Google can size its performance more reliably. There does not appear to be any rationale posted on Google's site regardin...

Is it safe to read a single c++ std::map object by different threads simultaneously without synchronization mechanisms?

I have a global object holding several c++ std::map objects. This object is supposed to be read only in a multithreaded environment. But i'm not sure whether there is any write operation when a C++ std::map object is being read within the implementation of std::map. The IDE is Visual Studio 2008. Should I provide some synchronization mec...

Kill activity in thread

How can I kill Android activity from asynchronous thread? In my android application, I start another activity using startActivity. Is there anyway for me to kill that activity I started after several minutes? Or is there any way beside using thread? ...

.NET Update WPF Control on own dedicated UI thread

Hi All I have a real-time application which constantly updates a UI log (RichTextBox control) in the form of a ListView control. The control is updated with current application data received via events. My application was running very slow and i found it was due to the ListView log being updated, which blocks the UI thread. As you can i...

how to write and execute a thread

i have never worked with threads before,so now im trying to creata a thread with a query to check database status,the query is as follow: select (*) as DBCount from v$datafile where statua in 'OFFLINE'; this query returns the total number of all the databases that are offline so i want to create a threa in delpi that will execute this q...

How to pass exception from one thread to another (caller's) thread in Delphi?

Hi again! I have another question! Please look at this example: // There is a class with some method: type TMyClass = class public procedure Proc1; end; // There is a some thread class: TMyThread = class(TThread) protected procedure Execute; override; end; procedure TMyClass.Proc1; begin // this method is just ...

Hooking thread creation/termination

Is it possible to hook into thread termination on Windows? IOW, I would like to be notified if a thread inside the process (not interested in other processes and their threads) has terminated (either normally or - more important - forcefully). Alternatively, hooking into thread creation would also do. Rationale: I have a library that m...

uploading records of list of files in parallel using pyton to DB

I have a list of files each file have mass of records separting by \n , i need to proccess those records in parallel and upload them to some sql server could someone provide an idea what is the best way to do this with python ...

Measure ContextSwitch Time C (Windows)

Hello, I need to implement a method that can measure Time and CPU cycles of context switch between threads in Windows. Here is my code #include <stdio.h> #include <windows.h> #include <time.h> LARGE_INTEGER initialTimeStamp, finalTimeStamp, freq; DWORD ThreadProc(LPVOID lpdwThreadParam) { SwitchToThread(); return 0; } int main() ...

custom allocator using move for vector of thread

I'm currently learning about concurrency in C++ and came across using a vector of threads, which I believe will be possible in C++0x. However, my current compiler doesn't appear to have an implementation of move-aware containers and so I get errors generated because std::thread::thread(const std::thread&) is deleted, ie I can only use th...

Making thread wait for exit without resorting to Thread.Sleep()

Hello, I'm having a problem trying to wrap my head around what I'm doing wrong while attempting a simple threading operation in one of my applications. Here's what I'm after: I want the main thread to spawn a separate thread; that separate thread will open a program, feed that program an argument (a filename) and then once that program...

Switch to background thread and continue method execution

I have a deserialization method (XML) that functions well until it gets to X number of objects. Below X, the time is takes to deserialize is acceptable and the UI being blocked is not a problem. However, if the number of objects is greater than X (relatively unlikely, but possible), then the load time is too long. Is it possible to jump ...

WPF loading animation on a separate UI thread? (C#)

Okay, I have a loading animation that runs while a large DataTable is populated to let the user know that the program has not frozen. I have the animation working fine, but it freezes while the DataTable is updatingv as well. Is there some way to have multiple UI threads, so that the animation will continue to run while the DataTable is ...

Best practice for continual running process in C#

I am working on a project in C#.NET using the .NET framework version 3.5. My project has a class called Focuser.cs which represents a physical device, a telescope focuser, that can communicate with a PC via a serial (RS-232) port. My class (Focuser) has properties such as CurrentPosition, CurrentTemperature, ect which represents the cur...

Periodicall popup form

Hello. I should implement periodically popup form at other form. This popup form isn't common design, so I couldn't use standard messages. I need implement smoothly showing\hiding of this popup form. Now I use timers for hide\show this form, but have strange problems. If I run only Show\Hide popup form process all is OK, but when I try ...

Best way to periodically drain the autorelease pool on a long-running background thread?

In the developer documentation, it says: If your application or thread is long-lived and potentially generates a lot of autoreleased objects, you should periodically drain and create autorelease pools (like the Application Kit does on the main thread); otherwise, autoreleased objects accumulate and your memory footprint grows. If, howe...

Closing JMX Connection for concurrent operations

I am opening a JMX Connection using getMBeanServerConnection() method and then closing it after use in a finally block. And, for a given JMX Connector, 2 successful calls to getMBeanServerConnection() usually returns the same MBeanServerConnection. Some of the operations are invoked concurrently, and each of them invokes getMB...

Terminate unresponsive thread

I have built a java application and have a thread thats doing something in the background when a button was pressed. The problem is, that thread might lock up, perhaps due to an infinite loop. Is there a way I can force terminate that thread? EDIT: I am using LuaJ on the java platform. It has the potential of locking up and I don't real...