C#/.NET Toolbox: Creating a "Safer" Task Dispose()(www.blackrabbitcoder.net)

submitted by BlackRabbitCoderBlackRabbitCoder(661) 7 months, 19 days ago

So recently, I’ve been moving some older utility classes logic over to use the excellent .NET Task Parallel Library (TPL). This library contains, at it’s core, a class called Task which allows parallel programming without the need of working directly with threads. During this process, I wrote a few extension methods I found to be useful in dealing with tasks in an easier manner, and thought I’d share them in a few posts. Today's will discuss an extension method to make disposing a task a little bit "safer".

6 comments |category: |Views: 204

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by codingbanditcodingbandit(37) 7 months, 18 days ago 0

Thanks for sharing - another useful tool for the toolbox :)

Reply

posted by dpetersondpeterson(4397) 7 months, 18 days ago 0

How do you feel about the TPL so far? Is doing something like this still better than using naked threads?

Reply

posted by BlackRabbitCoderBlackRabbitCoder(661) 7 months, 18 days ago 0

@codingbandit: Thanks!

@dpeterson: I like it. It's a convenient wrapper around thread pools that makes them easier to work with in general. That said you can get more performance out of threads if you know how to code them correctly, but the TPL is a great level of abstraction on top of them.

Reply

posted by dpetersondpeterson(4397) replied to BlackRabbitCoderBlackRabbitCoder(661), 7 months, 18 days ago 0

Thanks for the follow up. Do you think they're ready for scenarios where performance is a concern?

Reply

posted by vijaystvijayst(1311) 7 months, 16 days ago 0

A good utility. It is something that I will keep in mind while using TPL.

Reply

information Login or create an account to comment on this story