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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T21:56:39+00:00 2026-05-31T21:56:39+00:00

After googeling for ages, and reading some stuff about async task in books. I

  • 0

After googeling for ages, and reading some stuff about async task in books. I made a my first program with an async task in it. Only to find out, that i can only start one task. I want to run the task more then once. This is where i found out that that doesn’t seem to work. to be a little bit clearer, here are some parts of my code:

InitFunction(var);

This is the Task itself

    public async Task InitFunction(string var)
    {

            _VarHandle = await _AdsClient.GetSymhandleByNameAsync(var);

            _Data = await _AdsClient.ReadAsync<T>(_VarHandle);

            _AdsClient.AddNotificationAsync<T>(_VarHandle, AdsTransmissionMode.OnChange, 1000, this);

    }

This works like a charm when i execute the task only once.. But is there a possibility to run it multiple times. Something like this?

InitFunction(var1); 
InitFunction(var2); 
InitFunction(var3);

Because if i do this now (multiple tasks at once), the task it wants to start is still running, and it throws an exeption.

if someone could help me with this, that would be awesome!

~ Bart

  • 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-31T21:56:40+00:00Added an answer on May 31, 2026 at 9:56 pm

    async/await can work perfectly with multiple tasks, and multiple tasks at once. However, sometimes different objects can place restrictions on how many asynchronous operations can be outstanding at one time.

    For example, the Ping class can only be used to send one ping at a time. If you want to send multiple pings at once, you need to use multiple Ping instances.

    I suspect the same problem is at play here: _AdsClient probably is restricted to a single asynchronous operation at a time. So, if you want multiple InitFunctions to be run at once, you’ll have to use multiple instances of whatever type that is.

    On the other hand, if you wanted to run InitFunction multiple times, one at a time, then you just need to add some awaits to your calling code:

    await InitFunction(var1);
    await InitFunction(var2);
    await InitFunction(var3);
    

    This will probably work – unless _AdsClient has “one-time use” semantics. Some classes do have this restriction.

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

Sidebar

Related Questions

Inspired by this discussion , after some googling I wasn't able to find an
After googling and binging for a whole day about this, and even trying some
I want to learn about Code First development in EF4 and after googling about
After googling a bit I have found some tips about how to get online
After googling, browsing SO and reading , there doesn't seem to be a Rails-style
I've seen the following (bizarre) Javascript rounding function in some legacy code. After googling
After much googling and console testing I need some help with arrays in rails.
After googling, I have only found only this sad forum question . Is it
I am developing some Hid Managment classes on osx and after googling for quite
After googling extensively I cannot find any good resources on the practices / process

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.