multithreading

Is there a chance that sending an email via a thread could ever fail to complete?

I have a project where I send a couple of emails via a seperet thread, to speed up the process for the end-user. It works successfully, but i was just wondering whether there were any potfalls that i might not have considered? My greatest fear is that the user clicks a button, it says that the message has been sent (as it will have been ...

Sending Email Asynchronously inside a SharePoint workflow

I'm getting a weird threading issue inside a SharePoint workflow that I'd like to learn more about. I'm trying to send an email using SPUtility.SendEmail asynchronously by firing up a new thread to do it. This successfully works at the end of a workflow for a summary email. I tried doing the same to replace a task notification email but ...

Thread toggling

Hi all, In Ubuntu, I am running 2 'C' applications, When I press key up/down the applications are alternatively getting the events. What might be the problem/solution? Ex: I have 'A application' and 'B application', I launch 'A application' and press the key up/down its working fine. If I simultaneously launch 'B application' and focu...

Form Method on another thread not invoking the events.

I am trying to achieve an update form. I use a library to open a form when there is an updated file and download using edtFTPNet In the form I pass the FTP object and start download, in FormLoad i handle two events and i use Thread to StartDownload(). My two events never invoking, i use them to set a progress bar. public partial class...

Real-time thread updates issue

I'm working with many threads in a system where I know beforehand the total size of all files. When an observer is notified of a change by the subject it implicitly knows a file segment has been downloaded. I'll change this in the future as it's not explicit. The problem I'm having is that my percentage indicator doesn't get updated i...

does anyone see any issues with this thread pattern?

Here is a simple thread pattern that I use when writing a class that needs just one thread, and needs to a specific task. The usual requirements for such a class are that it should be startable, stopable and restartable. Does anyone see any issues with this pattern that I use? public class MyThread implements Runnable { private boo...

Add multiples Picturebox using ThreadPool

Hi! Im doing a Naval Battle for University. I decided to do it in C#. My board is 20 x 20 of mini (20x20) PictureBoxes. The problem is when I load the board I got a huuuge delay for draw all of them in the panel which contains them. So I thought to ThreadPool my method to escale the picuteres boxes creation and drawing fester. Is this ...

Why do people run Java GUI's on the Event Queue

In Java, to create and show a new JFrame, I simply do this: public static void main(String[] args) { new MyCustomFrameClass().setVisible(true); } However, I have seen many people doing it like this: public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { ne...

Thread.abort_on_exception doesn't work in rake task?

When I run Thread.abort_on_exception = true threads = [] threads << Thread.new do loop { sleep 1 } end threads << Thread.new do loop { sleep 1; raise } end threads.each { |t| t.join } as a straight-up ruby script, the script exits as you'd expect with abort_on_exception set to true. But when I try to run this same code as a ra...

Creating WPF components in background thread

Im working on a reporting system, a series of DocumentPage are to be created through a DocumentPaginator. These documents include a number of WPF components that are to be instantiated so the paginator includes the correct things when later sent to the XpsDocumentWriter (which in turn is sent to the actual printer). My problem now is th...

embedding multiple lua instances in a multiple threaded program

I have a program with 4 threads. Within each thread, I do a luaL_newstate(); Each thread only has access to it's own lua instance. Is there anything I need to worry about? [I.e. is there some hidden state that all lua instances share behind my back?] Thanks! ...

Storing each thread's data when using Semaphore

My task was to deal with problem of 5 eating thinkers. Each of them can eat only 10 times. Solution should base on Semaphore. I almost solved the task and output was correct when I simply used println for showing state of each thinker. But there is additional point to store those states in some sort of collection. And somehow I can't mak...

.NET threading solution for long queries

Senerio We have a C# .Net Web Application that records incidents. An external database needs to be queried when an incident is approved by a supervisor. The queries to this external database are sometimes taking a while to run. This lag is experienced through the browser. Possible Solution I want to use threading to eliminate the simu...

what happens to running/blocked runnables when executorservice is shutdown()

I posted a question about a thread pattern today, and almost everyone suggested that I look into the ExecutorService. While I was looking into the ExecutorService, I think I am missing something. What happens if the service has a running or blocked threads, and someone calls ExecutorService.shutdown(). What happens to threads that are r...

How do I have 1 UI thread wait for another UI thread

I have two UI threads. I want to make sure the first one is finishing running, and then run the other one. How could I do that? Thanks a lot! UIJob uiJob = new UIJob("settext1") { public IStatus runInUIThread(IProgressMonitor ipm) { webBrowser.setText(finalContent); return Status.OK_STATUS; } }; uiJob.schedule();...

How can you set a time limit for a PowerShell script to run for?

I want to set a time limit on a PowerShell (v2) script so it forcibly exits after that time limit has expired. I see in PHP they have commands like set_time_limit and max_execution_time where you can limit how long the script and even a function can execute for. With my script, a do/while loop that is looking at the time isn't appropri...

Socket fd in multithreading

Hi All, Is it ok to use same socket fd in multiple threads ? (over linux) ...

Is there such a thing as a lockless queue for multiple read or write threads?

I was thinking, is it possible to have a lockless queue when more then one thread is reading or writing? I seen an implementation with a lockless queue that worked with one read and one write thread but never more then one for either. Is it possible? I don't think it is. Can/does anyone want to prove it? ...

silverlight, xaml, threading problem

Hi! I want to have a thread, that polls the webservice. Howerver the thread doesnt work ... xxx.xaml.cs: public class Alpha:Page { // This method that will be called when the thread is started public void polling() { while (true) { Thread.Sleep(1000); ...

.Net Thread Execution

I have written a thread which I've started using the start method but I'm not able to know when the thread has done executing the method and destroy the thread object. _ProgressThread = New Thread(AddressOf ExecProc) _ProgressThread.IsBackground = False _ProgressThread.Start() //the flow of execution should come here only after the thr...