Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 152859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:41:55+00:00 2026-05-11T09:41:55+00:00

I’m writing a class library that will offer some asynchronous processing, and want to

  • 0

I’m writing a class library that will offer some asynchronous processing, and want to try and avoid running into threading issues later on down the line. So I’m after any suggestions people can make to avoid running into issues later on, and instead start with a good design.

Some of the situations that I can see that might cause problems, and am not neccessairly sure the best way to resolve:

1) I have a class that takes an IEnumerable and uses a ToList to construct an IList. The T’s are a class declared as public within my assembly. Upon starting an async process this IList is used to create a new collection, however at this point the calling assembly may be modifying the original T’s used to generate my new internal collection.

2) I have a Boolean property that I’m expecting the user to use in a polling loop. I’m fairly sure that this won’t be a problem with me setting the property in my assembly?

3) I regularly used an internal collection that needs to be used on two seperate threads. I’m currently planning to use a synchronized collection and clone it whenever I need a copy… although I’m hoping this won’t be too slow.

4) Throughout my async method I’m wanting to fire events whenever the progress or status changes. Do I need to be aware of anything when firing events from processing threads? Again with some of these I need to pass a variable which will be taken as a clone of something used internally within the processing threads to try and avoid any issues with the user changing it.

Thanks in advance for any assistance!

Ian

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T09:41:55+00:00Added an answer on May 11, 2026 at 9:41 am

    1) Try to make your types immutable if possible. If that’s not possible, you need to work on appropriate locking.

    2) Make the underlying variable volatile so that updates get seen in all threads

    3) We’d need more information to be able to sensibly comment.

    4) The event handlers would need to be aware that they could be called on multiple threads. You should also look at a fully thread-safe event pattern if you need to be able to subscribe to and unsubscribe from events from various threads.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 205k
  • Answers 205k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer the mail function doesn't handle authentication, like you have to… May 12, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer var query = from sb in db.Surfboards join csb in… May 12, 2026 at 8:59 pm
  • Editorial Team
    Editorial Team added an answer I think the problem here is that the service type… May 12, 2026 at 8:59 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
In order to apply a triggered animation to all ToolTip s in my app,
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.