multithreading

Push notification or thread with timer

Hi all, In my application, I'm having functionality like twitter that when you have not refreshed your screen, and if there're new messages then you get this message that "You have n new messages" and a refresh button, which on press will refresh the screen. I'm basically fetching all the data from an xml with some url. In case of thr...

How to handle error on other thread?

Hi, I'm trying to handle errors that have occurred on other threads the .NET CF program is like below: static void Main() { Thread t = new Thread(Start); t.Start(); ... } void Start() { ... Exception here } In my situation, putting try catch in the Start method is impossible. How can I handle it in the global code?...

how to exit or stop a running thread in c?

i am using Win32 API. i have a thread in c and want to terminate it from out side the thread so can't use exitthread() i can't use any wait options cause i have to kill this thread and start it again in very short time. need help, ...

Sending multiple requests simultaneously to the Server using Selenium with Java

I wish to send multiple requests to the server, simultaneously. The problem statement will be: Read a text file containing multiple URL’s. Open each URL in the web browser. Collect the Cookie information for each call, and store it to a file. Send another call: http://myserver.com:1111/cookie?out=text Store the output (body text) o...

UIView animation cancels previous animation?

Hi I have an NSTIMER that counts the time, and on t = 10, it fires an animation but during that time it might happen that another animation is running. This causes the previously running animation to cut off. Any idea? i thought UIVIEW animations were ran in diff threads. I cannot use a willstop selector here since t = 10 might happen wh...

C# COM Messaging system design

Hi all, I can use some help for a designing my COMport connection classes. I have a device with a microcontroller (which I programmed) connected to my comport. Whenever I send a message to it, it should send an acknowledge. So whenever I send something over the comport, it should wait for an acknowledge before continuing. Ofcourse, I ...

ASP.NET Page.Cache versus Page.Application storage for data synchronization?

Both Page.Cache and Page.Application can store an application's "global" data, shared among requests and threads. How should one storage area be chosen over the other considering scenarios of data synchronization in the multi-threaded ASP.NET environment? Looking for best practice and experienced recommendation. ...

Processing a database queue across multiple threads - design advice

I have a SQL Server table full of orders that my program needs to "follow up" on (call a webservice to see if something has been done with them). My application is multi-threaded, and could have instances running on multiple servers. Currently, every so often (on a Threading timer), the process selects 100 rows, at random (ORDER BY NEWID...

Using .NET 4.0 Task in ASP.NET

Are there any caveats or short comings to using the new Task API in System.Threading.Task in ASP.NET hosted under IIS? I know prior to .NET 4.0 working with any of the ThreadPool actions inside of IIS was always recommended to be avoided. ...

How to make a thread that runs at x:00 x:15 x:30 and x:45 do something different at 2:00.

I have a timer thread that needs to run at a particular moments of the day to do an incremental replication with a database. Right now it runs at the hour, 15 minutes past the hour, 30 minutes past the hour and 45 minutes past the hour. This is the code I have which is working ok: public class TimerRunner implements Runnable { pr...

Fast way to pass a simple java object from one thread to another

I have a callback which receives an object. I make a copy of this object, and I must pass it on to another thread for further processing. It's very important for the callback to return as fast as possible. Ideally, the callback will write the copy to some sort of lock-free container. I only have the callback called from a single thread ...

How can I pipe two Perl CORE::system commands in a cross-platform way?

I'm writing a System::Wrapper module to abstract away from CORE::system and the qx operator. I have a serial method that attempts to connect command1's output to command2's input. I've made some progress using named pipes, but POSIX::mkfifo is not cross-platform. Here's part of what I have so far (the run method at the bottom basically ...

how a thread can signal when it's finished?

#include <iostream> #include <boost/thread.hpp> using std::endl; using std::cout; using namespace boost; mutex running_mutex; struct dostuff { volatile bool running; dostuff() : running(true) {} void operator()(int x) { cout << "dostuff beginning " << x << endl; this_thread::sleep(posix_time::seconds(2)...

How can one manage to fully use the newly enhanced Parallelism features in .NET 4.0?

I am pretty much interested into using the newly enhanced Parallelism features in .NET 4.0. I have also seen some possibilities of using it in F#, as much as in C#. Despite, I can only see what PLINQ has to offer with, for example, the following: var query = from c in Customers.AsParallel() where (c.Name.Contains("customer...

Kernel.Select from ruby causing Thread(0x7f1a159abd58): deadlock (fatal)

I don't have multiple threads or anything like that, and I thought select() was non-blocking, however, as I add more items to an array used as the IO object, and using select(), after about 1000~ items in the array (with some interaction on them).. the whole script exits with a deadlock / fatal error... Hope any1 could help Thank you so...

Is this ruby code thread safe?

Is this code threadsafe? It seems like it should be, because @myvar will never be assigned from multiple threads (assuming block completes in < 1s). But do I need to be worried about a situation where the second block is trying to read @myvar as it's being written? require 'rubygems' require 'eventmachine' @myvar = Time.now.to_i Eve...

Minimizing Java Thread Context Switching Overhead

I have a Java application running on Sun 1.6 32-bit VM/Solaris 10 (x86)/Nahelem 8-core(2 threads per core). A specific usecase in the application is to respond to some external message. In my performance test environment, when I prepare and send the response in the same thread that receives the external input, I get about 50 us advanta...

How to correctly stop thread which is using Control.Invoke

I tried the following (pseudocode) but I always get a deadlock when Iam trying to stop my thread. The problem is that Join() waits for the thread to complete and a pending Invoke() operation is also waiting to complete. How can I solve this? Thread workerThread = new Thread(BackupThreadRunner); volatile bool cancel; // this is the thre...

Application.Current.Shutdown() vs. Application.Current.Dispatcher.BeginInvokeShutdown()

First a bit of background: I have a WPF application, which is a GUI-front-end to a legacy Win32-application. The legacy app runs as DLL in a separate thread. The commands the user chooses in the UI are invoked on that "legacy thread". If the "legacy thread" finishes, the GUI-front-end cannot do anything useful anymore, so I need to shut...

C# - periodic data reading and Thread.Sleep()

Hello, my C# application reads data from special USB device. The data are read as so-called "messages", each of them having 24 bytes. The amount of messages that must be read per second may differ (maximal frequency is quite high, about 700 messages per second), but the application must read them all. The only way to read the messages ...