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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:29:57+00:00 2026-05-26T09:29:57+00:00

I am calling few methods on a button click. functionA() functionB() functionC() All three

  • 0

I am calling few methods on a button click.

functionA()

functionB()

functionC()

All three functions are independent from each other and they take long time to execute. I checked and found that by threading I can run all three together which will save the execution time.

As I am new to threading concept, could anyone please guide me the simplest way I can do threading in scenario or other way which will be useful in this scenario.

EDIT

One more problem in the same function:

I am binding 5 gridviews after the three functions execution. Like this

            gv1.DataSource = GetData("Mill");
            gv1.DataBind();

            gv2.DataSource = GetData("Factory");
            gv2.DataBind();

            gv3.DataSource = GetData("Garage");
            gv3.DataBind();

            gv4.DataSource = GetData("Master");
            gv4.DataBind();

They all are using the same method for getting the result and they are also taking time to load. Is there any way I can run them parallel too? I afraid, because they are using same method to get the data. Is it possible to do threading for them. How ?

  • 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-05-26T09:29:58+00:00Added an answer on May 26, 2026 at 9:29 am

    I am not sure how Parallel.Invoke() decides what to execute in parallel, but if you want an assurance that they will execute in parallel, use threads:

    var t1 = new Thread(MySlowFunction);
    t1.IsBackground = true;
    t1.Start();
    
    var t2 = new Thread(MySlowFunction);
    t2.IsBackground = true;
    t2.Start();
    
    # To resync after completion:
    t1.Join();
    t2.Join();
    

    Or even better, use the ThreadPool:

      ThreadPool.QueueUserWorkItem(MyWork);
    

    Remember to handle your thread exceptions.

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

Sidebar

Related Questions

I am trying to learn a few different methods of calling functions by address.
I have a few WCF services I am calling from a console app. I
We have a winforms application calling a stored procedure every few seconds. The stored
Calling all C macro gurus... Is there any way to write a C macro
Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
I've read a few other questions that seem similar but I'm still very confused,
I have a few questions regarding differentiation between const and non-const versions of methods
I have a few methods like this public void DoSomething(Action<int> action) { ... }
I'm processing data from an application that has a few quirks in how it
I've used async methods today, calling methods asynchronously and using the caller's callback methods.

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.