I have a thread that modifies a passed pointer to an object (which is alloc'd and retained in the calling thread) in a loop. If I put the pointer in the autorelease pool, I sometimes get errors because the object is being released when it shouldn't. I took it out of the autorelease pool and this seems to work. However, I am worried about...
Suppose I have a message pump class in C++0x like the following (note, SynchronizedQueue is a queue of function<void()> and when you call receive() on the queue and it is empty, it blocks the calling thread until there is an item to return):
class MessagePump
{
private:
bool done_;
Thread* thread_;
SynchronizedQueue queue_;...
As for as I know, Java threads can communicate using some thread APIs. But I want to know how the Java threads and the OS threads are communicting with each other. For example a Java thread needs to wait for some OS thread finishes its execution and returns some results to this Java thread and it process the same.
...
I've learned that you should usually stick with either forking or threading to avoid running into very strange and extremely hard-to-debug problems, so until now I always did exactly that. My problem with the matter is that when I stick with only forking, creating many short-lived processes to distribute chunks of work to gets the more e...
Hello
gcc 4.4.3 c89
I have a event loop that runs in a separate thread.
My design is like this below, just sample code to help explain.
I need to somehow wait for the initialization to complete before I can make a call to the get_device_params.
I did put a usleep for 3 seconds just before the call to the get_device_params, but I do...
I am pretty new to Android and very new to Multithreading.
I am writing an android application that contains multiple activities that implement onClickListners which sends a Bluetooth message on button click to . I have successfully been able to connect and keep my BluetoothSocket and OutputStream open while in one activity. I do not do...
Creating a .net application in C#, windows forms. How do I update the progress bar 1 step every cycle of a 100 cycle loop?
(I’m processing an excel sheet in the loop.)
The progress bar controls are in the UI class which connects to the controller class which connects to a custom class
(MVC pattern). The loop is in the custom class.
Do I...
hello,
with Junit4, i tried to write a test (.class) that contains 3 @test and need to open the appli in each test
so in the function init that start the appli and close it :
@BeforeClass
public static void setupOnce() {
final Thread thread = new Thread() {
public void run() {
//start the appli in the main
thread.start();
}
}
}
@...
Hi All
I am building a real-time multi-threaded application in WPF, but i am having difficulties in updating the UI.
I have a background worker thread that contains logic which determines what trades to send into the market. When a valid trade is sent to the market, i receive status updates on these trades via events in my main applica...
I tried to create a dialog in a UI thread(CWinThread).
However, it crashes when the CDialog::Create() is called.
I had verified with previous implementation, the dialog is successfully created in non-threading mode.
Does any guru here know the crash reason of creating a dialog in CWinThread?
Without Threading:
class CProduction : publ...
We've been experiencing a strange deadlock during the startup of our java application. When I run jstack on the application to investigate, I see that the AWT-EventQueue is in Object.wait(), but the thread is still marked as RUNNABLE. I've included the relevent parts of the thread dump, and I'm hoping that someone can shed some light o...
I have one thread that inserts into the queueStream (not shown here) and FlowController which is another thread that pops from the queue if the queue is not empty.
I verified that the data is inserted into the queue correctly with the debug code in addToQueue()
Problem is, the 'if queueStream' statement in FlowController always sees th...
with junit test , how could I start the application software then close it properly and do it for each test ?
@test public void test1(){ // start
appli //test Jtextfield //close appli
}
@test public void test2(){ // start
appli //test ComboBox //close appli }
@test public void test3{ // start
appli //test Jbutton //close appli
}
...
What is the most efficient way to collect and report performance statistic analysis from an application?
If I have an application that uses a series of network apis, and I want to report statistics at runtime, e.g.
Method doA() was called 3 times and consumed on avg 500ms
Method doB() was called 5 times and consumed on avg 1200ms et...
Hey guys,
I have sort of a simple question. I am writing an Objective-C program with some multithreading. I have a global NSArray, and I add objects into that NSArray from a method that is called in a new thread. If the objects I add into that NSArray are new objects created in that method (local), will that create memory access and/or ...
I have multiple threads accessing variables. I know how to write spinlocks and use the Threading.Interlocked methods to increment etc. variables.
However, I want to perform the equivalent of:
a = Math.Min(a, b)
or
a = a | 10
... but without using a critical section. Is this possible? I know the 2nd line is possible in assembler, but ...
Hi Everyone,
I am trying to use urllib3 in simple thread to fetch several wiki pages.
The script will
Create 1 connection for every thread (I don't understand why) and Hang forever.
Any tip, advice or simple example of urllib3 and threading
import threadpool
from urllib3 import connection_from_url
HTTP_POOL = connection_from_url(url...
I am trying to give some user entertainment, and show a "please wait" window, with Marquee, during the loading of a separate complex Window. I am attempting to do this by loading the Window in a new thread, like this:
Public Function ShowPleaseWait() As System.Threading.Thread
Dim PleaseWait As New System.Threading.Thread(...
Hi,
What I have is a loop reading some data and when a set of circumstances are met I need to instantiate a thread. However, the created thread might not complete before the loop criteria is met and I need to create another thread doing the same thing. This is part of an ocr app and I haven't done much thread work before.
while loop
...
If I use CreateEvent to open an event:
responseWaitEvent = CreateEvent(NULL, // no security
TRUE, // manual-reset event
FALSE, // not signaled
(LPTSTR)eventName); // event name
And this event already exists and has been signaled. Will this call reset the signal (because of setting initial state to FALSE).
Or ...