I have a C# application that has to constantly read from a program; sometimes there is a chance it will not find what it needs, which will throw an exception. This is a limitation of the program it has to read from.
This frequently causes the program to lock up as it tries to poll. So I solved it by spawning the 'polling' off into a sep...
I have to develop a class which can run it's own hard-coded task in a background thread and communicate with container class sending him progress updates and taking messages from it. I believe I am going to extend BackgroundWorker class but it looks a bit weird to extend and I haven't managed to find a good example wit Google. Can you sh...
I have a Windows Forms application with a BackgroundWorker. In a method on the main form, a MessageBox is shown and the user must click the OK button to continue. Meanwhile, while the messagebox is being displayed, the BackgroundWorker finishes executing and calls the RunWorkerCompleted event. In the method I have assigned to that eve...
I am creating a graphing calculator.
In an attempt to squeeze some more performance out of it, I added some multithreaded to the line calculator. Essentially what my current implementation does is construct a thread-safe Queue of X values, then start however many threads it needs, each one calculating a point on the line using the queu...
When I create a thread I save it handle in a list.
After a time I want to check which of them still exists.
I'm not looking for other kind of implementation, I want to know if is there some how to get a thread by it handle ?
...
I study this code from some book:
#include <pthread.h>
#include <stdio.h>
/* Parameters to print_function. */
struct char_print_parms {
/* The character to print. */
char character;
/* The number of times to print it. */
int count;
};
/* Prints a number of characters to stderr, as given by PARAMETERS,
which is a...
Everything is in the title.
On the official documentations it is stated that Note that services, like other application objects, run in the main thread of their hosting process and AsyncTask only works if it is executed in the UIThread.
So is it possible to use AsyncTask in a Service class?
I am trying to do so but I'm always getting ...
I’m buried in multithreading / parallelism documents, trying to figure out how to implement a threading implementation in a programming language I’ve been designing.
I’m trying to map a mental model to the pthreads.h library, but I’m having trouble with one thing: I need my interpreter instances to continue to exist after they complete ...
So I'm aware that nothing is atomic in C++. But I'm trying to figure out if there are any "pseudo-atomic" assumptions I can make. The reason is that I want to avoid using mutexes in some simple situations where I only need very weak guarantees.
1) Suppose I have globally defined volatile bool b, which
initially I set true. Then I la...
I’m looking into multithreading, and GCD seems like a much better option than manually writing a solution using pthread.h and pthreads-win32. However, although it looks like libdispatch is either working on, or soon going to be working on, most newer POSIX-compatible systems… I have to ask, what about Windows? What are the chances of lib...
I'm writing a c# application that can create a series of request messages. Each message could have a response, that needs to be waited on by a consumer.
Where the number of outstanding request messages is constrained, I have used the windows EVENT to solve this problem. However, I know there is a limit on how many EVENT objects can be c...
I have a QThread derived class that communicates with the main thread by sending QEvents to it.
What is the best way for the main thread to communicate with the second thread?
The main thread has a pointer to the second one.
...
I see it's easy to open pipe between two process using fork, but how we can passing open pipe to threads.
Assume we need to pass out of PROGRAM A to PROGRAM B "may by more than one thread",
PROGRAM B send his output to PROGRAM C
EDIT:
I come again after modifying the code to become more easy for reading.
#include <stdio.h>
#include <s...
Hi,
I'm currently working on an IPhone App that should make the phone vibrate if a special event occurs.
The checks to trigger the alert is done in a thread.
Unfortunately the phone won't vibrate if I call
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
from inside the thread. (It works fine if I call this in my "viewDidAppe...
As the subject says, I'm posting events from non-GUI thread (some GStreamer thread, to be precise). Code looks like this:
GstBusSyncReply on_bus_message(GstBus* bus, GstMessage* message, gpointer data)
{
bool ret = QMetaObject::invokeMethod(static_cast<QObject*>(data), "stateChanged", Qt::QueuedConnection);
Q_ASSERT(ret);
r...
Hi all.In my project I am using thread to search via bluetooth devices.But when it searchs some times it crashs and appears ble screan.I couldent read all because it restarts computer but I saw that it is abour some ram blocks. X8001 something like this.Is thread couse this?Or I am also using database Mysql.When it searchs it also gets v...
Hi,
I'm using Glassfish 3 Web profile and can't get http workers to execute concurrently requests on a servlet.
This is how i observed the problem. I've made a very simple servlet, that writes the current thread name to the standard output and sleep for 10 seconds :
protected void doGet(HttpServletRequest request, HttpServletResponse...
I am programming in a Win32 nt5 environment.
I have a function that is going to be called many times. Each call is atomic. I would like to use QueueUserWorkItem to take advantage of multicore processors.
The problem I am having is I only want to give the function 3 seconds to complete. If it has not completed in 3 seconds I want to te...
I have a method shout() with a synchronized block.
private void shout(){
System.out.println("SHOUT " + Thread.currentThread().getName());
synchronized(this){
System.out.println("Synchronized Shout" + Thread.currentThread().getName());
try {
Thread.sleep(50);
}
catch (InterruptedException e) {
...
I guess I miss some basical stuff, regadring threads. However, here my problem:
I have a monitor running. On the other hand I have a test. The test does execute a sql query several times, between each execution waiting some ms with Thread.sleep(xy).
for (int i = 0; (i < iterationsteps); i++) {
rs = myQuery.execute();
//check ...