PC Review


Reply
Thread Tools Rate Thread

Re: Object Pooling in Background Thread 3.5 Sample?

 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      15th Oct 2009
SnapDive <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

> I would like to instance 20 objects (not kidding about the number) on
> background threads and then issue asynchronous method calls to them.
> They do not need to send anything back to the caller. If one of the
> instances hangs then I would like to know.


So you have 20 calls at one time that are necessary for a single
process? Or are you trying to rewrite the thread pool in a custom
manner?

Spinning up threads and determining if there is an error is quite easy
in .NET with event handlers. And I see nothing particularly incidious
about 20 threads running in a .NET application.

The issue I see is if you are opening 20 threads and then leaving them
open for when you need to run processes, as this can be accomplished
through a thread pool without writing your own custom pool.

I guess the question is "what is the problem you are trying to solve?"
and not "How do I solve the problem THIS way?"

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      19th Oct 2009
SnapDive <(E-Mail Removed)> wrote in
news(E-Mail Removed):

> So, why not just instance all 20 objects and put them in a pool, when
> one is needed use it on a background thread? That way when one "goes
> bad", processing can continue from the main app.


I will have to take some time to mull this over, but it appears sound on
the surface.

Jon Skeet created a custom thread pool, if that might help:
http://www.yoda.arachsys.com/csharp/miscutil/

It is at least worth a shot.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      22nd Oct 2009
SnapDive <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

>
> I'll check out the link.
>
> Did you have time to mull things over, Gregory?


I did not have time to realy go through it, but I still have come up with
no overwhelming reason not to set up a thread pool. And I trust Jon Skeets
work, if that will help you get started.

It has been crazy for me lately <g>

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Start background thread when a UI button is clicked, and Update UIbutton from background thread Curious Microsoft Dot NET 0 31st Mar 2010 10:01 PM
Re: Object Pooling in Background Thread 3.5 Sample? Peter Duniho Microsoft Dot NET Framework 0 14th Oct 2009 09:11 PM
Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on Joe Microsoft C# .NET 4 12th Mar 2007 10:59 AM
Thread A calls a delegate on Thread B but Thread A executes it!?!? Paul Tomlinson Microsoft C# .NET 4 3rd Feb 2005 11:09 PM
Shut down thread - thread closes form, form doesn't close because thread calls it etc... Robin Tucker Microsoft VB .NET 4 17th Oct 2003 12:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:43 PM.