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. C#
  4. Interrupt a function

Interrupt a function

Scheduled Pinned Locked Moved C#
tutorialquestion
4 Posts 3 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.
  • J Offline
    J Offline
    Johnny 0
    wrote on last edited by
    #1

    Is there any way to interrupt a function once it is called if it is not part of your code? For example: DataTable.Load(IDataReader); I'd like to be able to simply stop the execution of the load function. I guess I could use an async call but I am doing this from a form, is it safe to do it ? Thanks

    E S 2 Replies Last reply
    0
    • J Johnny 0

      Is there any way to interrupt a function once it is called if it is not part of your code? For example: DataTable.Load(IDataReader); I'd like to be able to simply stop the execution of the load function. I guess I could use an async call but I am doing this from a form, is it safe to do it ? Thanks

      E Offline
      E Offline
      Ed Poore
      wrote on last edited by
      #2

      ~Johnny~ wrote:

      Is there any way to interrupt a function once it is called if it is not part of your code?

      Why, you trying to write a debugger or something?

      ~Johnny~ wrote:

      I guess I could use an async call but I am doing this from a form

      You could, this would be the best way.

      ~Johnny~ wrote:

      is it safe to do it ?

      If you know how.

      1 Reply Last reply
      0
      • J Johnny 0

        Is there any way to interrupt a function once it is called if it is not part of your code? For example: DataTable.Load(IDataReader); I'd like to be able to simply stop the execution of the load function. I guess I could use an async call but I am doing this from a form, is it safe to do it ? Thanks

        S Offline
        S Offline
        S Senthil Kumar
        wrote on last edited by
        #3

        ~Johnny~ wrote:

        is it safe to do it ?

        One problem with interrupting other threads/functions is that you wouldn't know if it holds any locks when you are interrupting - if it did, then anyone attempting to lock on the same object will deadlock.

        Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro

        J 1 Reply Last reply
        0
        • S S Senthil Kumar

          ~Johnny~ wrote:

          is it safe to do it ?

          One problem with interrupting other threads/functions is that you wouldn't know if it holds any locks when you are interrupting - if it did, then anyone attempting to lock on the same object will deadlock.

          Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro

          J Offline
          J Offline
          Johnny 0
          wrote on last edited by
          #4

          Scary!

          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