multithreading

WinAPI I/O Redirection - Read as Information is Available using Anon Pipes & Threads

I am creating an application which will read the output from another application (which I did not write) which sends its output to a command prompt. I need to be able to write this information an "Edit" dialog within my GUI program. I have accomplished this using anonymous pipes and multi-threading (a worker thread for writing and anothe...

Running JPanels in their own threads.

I'm having a bit of trouble with Swing components. In one JFrame, I have a GLCanvas and a JEditorPane separated by a JSplitPane. This configuration makes display response choppy in both panels. However, when I place the GLCanvas and JEditorPane each in their own JFrame, display response is great. I would assume this is because, in ...

Pausing a thread using threading class

I have a long process that i've scheduled to run in a thread, because otherwise it will freeze the ui in my wxpython application. I'm using threading.Thread(target = myLongProcess).start() to start the thread and it works, but I don't know how to pause and resume the thread. I looked in the python docs for the above methods, but was...

How would you stop a thread when the Window is closing and...

...the class with the running thread is far away from the closing_event of the window. btw. we use composite application block from MS. ...

Debugging a Multithreaded C# - C++/CLI - C++ Solution in Visual Studio 2008: What are these threads?

I've inherited a project consisting of three levels of code. The lowest layer is native C++ that interacts with hardware. This is mature, stable and well-tested. The intermediate level code is C++/CLI, which interacts with top-level C# code that contains the UI elements and some additional functionality. This C# code is incomplete and wa...

Why ThreadGroup is being criticised?

I'm aware of current practice of using Executors instead of ThreadGroup: generally preferred way to deal with Threads catching exceptions from threads, etc... However, what are the inherent flaws of ThreadGroup as such (I've heard a vague criticism for that class)? Thanks for answer. PS. this does not seem to answer this question. ...

CoInitializeEx and CoInitializeSecurity failure

I have a C# method that is calling a C++ method. The C++ method uses WMI, so it calls CoInitializeEx(0, COINIT_MULTITHREADED) and then CoInitializeSecurity etc... before making the WMI select. My Problem, CoInitializeEX if failing with code 2147417850 (RPC_E_CHANGED_MODE) I tried to create a new STA thread from c# and call the c++ meth...

Android local services : are they that useful ?

I don't see the point of using a local service in Android. If I want to do backgound stuff, I can create a thread and use Handlers. Creating a local service is a big headache, you have to mess with Binders, worry about the start/stop/bind/unbind lifecycle, etc. What does a local service get me that a thread doesn't ? ...

Running an application as a thread and not a process

A while back, I asked a question on here about how to run an application as a thread in the memory space of another application, rather then a new process: http://stackoverflow.com/questions/3169234/executing-a-program-as-a-thread-and-not-as-a-process As a follow up to that question, I think I have a theory on how I might do this to ach...

ExecutorService, how to wait for all tasks to finish

What is the simplest way to to wait for all tasks of ExecutorService to finish? My task is primarily computational, so I just want to run a large number of jobs - one on each core. Right now my setup looks like this: ExecutorService es = Executors.newFixedThreadPool(2); for (DataTable singleTable : uniquePhrases) { es.execute(n...

Interlocked.Increment of Reflected Value Type

I want to increment integer members of an object using Interlocked.Increment, but I want to reference those integers via reflection. Example code I have, which is not working, is below. public class StatBoard { #region States (count of) public int Active; public int Contacting; public int Polling; public int Conn...

.Net: Static classes and multithreading?

hi I was told that in multithread programs, we would have some troubles by static classes. Could you please explain it more ? ...

A concurrent issue among threads.

Suppose I have a instance variable that has original value: Integer mMyInt = 1; There are two threads. The first changes mMyInt by calling: void setInt() { mMyInt = 2; } The second thread gets mMyInt by calling: Integer getInt() { return mMyInt; } Both threads don't use synchronization. My questions is, what is the possi...

Which Android service path to choose for implementing a large upload?

I am trying to implement a RESTful API in which I have to upload files that are relatively large for a mobile platform. The upload could take anywhere from 30 seconds to 5 minutes. I would like my application to be completely usable while the upload takes place. I've been doing some research and I've come across a few methods from whic...

[Android] LocationsListener does not stopp - even if removeUpdates called

Hey guys, I've a really strange problem, I'm getting location updates with a GPS Listener, everything works fine. I also watch this listener with a timeout, if the timeout gets exeeded, it stops the thread, removesLocation updates everything works... BUT, if there's no Internet Connection available, an exeption gets called, it should ...

Array of structs, multithreading, can I write at the same time to different indexes?

Hi I have an huge array which contains a struct "Tile". The program im writing is a 2D game, and I don't want different players (handled by different threads) to write their position to the same tile at the same time, and I wondered two things. Can two threads write to two different places in the array at the same time safely, and is th...

How to communicate by (socket, Thread) to transfer file?

How to communicate by (socket, Thread) to transfer file? ...

httpurlconnection thread safety

Hi, Is HttpUrlConnection thread safe? I.e. if I have an HttpConnection instance connected to a server and this instance is used by different threads (e.g.try to send a POST concurrently) how will this situation be handled by HttpUrlConnection? a) Will they send the POSTs serially, or b) the first thread sends the POST, gets the respons...

Is it possible to update views while doing a task without multithreading in iPhone OS?

I'm trying to set up a view that gives feed back via progress bar while it carries out a task, by incrementally sending updates to the view. I don't know much about multithreading, so I'm trying to do this without using it. Is there a way to force a view to update? It seems like there should be something to do this, cause I'm not really...

c++ multithreaded task queue for scheduled tasks

I need to develop a module which will execute scheduled tasks. Each task is scheduled to be executed within X milliseconds. The module takes as a parameter an amount of worker threads to execute the tasks. The tasks are piled up in a queue which will probably be a priority queue, so a thread checks for the next-in-queue task (the one w...