Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Asynchronous Callbacks

Asynchronous Callbacks

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharpdatabasedesigntutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tim McCurdy
    wrote on last edited by
    #1

    Before you think this is just another "How do I...?" please read. I DO NOT need to know how to do async operations. Here's my scenario... I am performing Async callbacks on a Form to retrieve data on a seperate thread. I am using Delegates not Threads. First, I am not simply calling one Query and Oh, we're done. I kick off about 7 different delegates to load data from different sources. I am using "SyncLocks" or "lock" in C# with different Lock objects per data I am retrieving. One thing that is happening now is that users are CLOSING my form while data is still loading. Obviously, this causes numerous errors because the Callbacks do not have a UI thread to go back to. My question is, how can I cancel an Async operation or gracefully exit running one?

    J 1 Reply Last reply
    0
    • T Tim McCurdy

      Before you think this is just another "How do I...?" please read. I DO NOT need to know how to do async operations. Here's my scenario... I am performing Async callbacks on a Form to retrieve data on a seperate thread. I am using Delegates not Threads. First, I am not simply calling one Query and Oh, we're done. I kick off about 7 different delegates to load data from different sources. I am using "SyncLocks" or "lock" in C# with different Lock objects per data I am retrieving. One thing that is happening now is that users are CLOSING my form while data is still loading. Obviously, this causes numerous errors because the Callbacks do not have a UI thread to go back to. My question is, how can I cancel an Async operation or gracefully exit running one?

      J Offline
      J Offline
      Josh Smith
      wrote on last edited by
      #2

      Since executing a delegate asynchronously means that the target method executes on a thread from the CLR's thread pool, you will not have fine-grain control over the worker thread. If you need the ability to manipulate the worker thread you should explicitly create it. Josh

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups