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 8069201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:56:45+00:00 2026-06-05T12:56:45+00:00

I have a question. Is it possible and valid, if I have an object

  • 0

I have a question. Is it possible and valid, if I have an object with a method DoSomething(), if I create multiple threads for this method, will it work and would it run as a seperate thread of its own?

E.g.

public class SomeClass
{
    public void DoSomething()
    {
        //somethings done here
    }
}

public class MainProgram
{
    public MainProgram()
    {
         InitializeComponents();
    }

    protected override OnStart(string[] args)
    {
         SomeClass sc = new SomeClass();
         Thread workerOne = new Thread(() => sc.DoSomething());
         workerOne.Start();

         Thread workerTwo = new Thread(() => sc.DoSomething());
         workerTwo.Start(); //start a new thread calling same method
    }
}

I hope that kind of explains what I mean. Would this work or cause any problems?

I am writing a program that needs to almost be realtime software, I am currently deciding whether initialising a new instance of SomeClass is better or not?

Hope someone can answer. If my question’s dont make sense, please comment and I’ll explain further!

Thanks,

Base33

PS The code was written specifically for the example 🙂

  • 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. Editorial Team
    Editorial Team
    2026-06-05T12:56:47+00:00Added an answer on June 5, 2026 at 12:56 pm

    Each thread has a separate call stack, so yes they can both be using the same method on the same object. And indeed, if needed each thread can (via recursion) call the same method on the same instance multiple times if you really want.

    However, what might trip you up is if you are using state in that object (instance or static fields, etc, and anything related from that state). You will need to ensure your access to any shared state gives full consideration (and presumably synchronisation) to multi-threaded access.

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

Sidebar

Related Questions

The question I have is if it is possible to create a control, similar
Easy question, it is valid to have overlapping spans in html? Example: <span id=1>This
Possible Duplicate: What's the point of valid CSS/HTML? This is a over-asked question, but
I have a simple question Is it possible to download a specific resource file
I have a question regarding the onkeypress event on JavaScript. Is it possible to
I have a question about IPTC metadata. Is it possible to search images that
Possible Duplicate: Detect multitouch with Ontouch listener Android I have a question about detecting
Possible Duplicate: Detect Facebook page fan on the website I have a question to
Possible stupid question: let's say I have two apps contained within one project. Can
I have a very simple question: Is it possible to change the price of

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.