Is this a good use for ThreadPool.QueueUserWorkItem?
Posted
by
Matt Grande
on Programmers
See other posts from Programmers
or by Matt Grande
Published on 2012-06-26T14:18:27Z
Indexed on
2012/06/26
15:24 UTC
Read the original article
Hit count: 292
c#
|multithreading
I have an application that, among other things, imports documents, then emails necessary parties to let them know that a document has been imported.
It turns out that determining whom to email, then performing the emailing, is what's taking the longest. I was thinking of doing something like this:
var document = ImportDocument();
ThreadPool.QueueUserWorkItem(s => SendEmail(document.Id));
return document;
... similar to DelayedJob in Rails, if that helps. Does that make sense in this context? What would you do?
© Programmers or respective owner