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. Web Development
  3. ASP.NET
  4. Threading in .Net (C#)

Threading in .Net (C#)

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasequestion
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.
  • V Offline
    V Offline
    Venkat Eswaran
    wrote on last edited by
    #1

    Hi, I have a page that calls a sql procedure and it runs for 20 - 40 min. I use usual threading for this page. Thread objthread = new Thread(new ThreadStart(ticketingThread)); objthread.Start(); As i dont know when it will end. i never abort the thread. what happens is when user uses the page for 1 weeek, the page starts hanging. I dont know what happens. When i tried debugging it works fine. I also saw creating thread in threadpools ThreadPool.QueueUserWorkItem(new WaitCallback(ticketingThread)); Please advise which one i have to follow and what is the difference between the two. Thanks Venky

    M 1 Reply Last reply
    0
    • V Venkat Eswaran

      Hi, I have a page that calls a sql procedure and it runs for 20 - 40 min. I use usual threading for this page. Thread objthread = new Thread(new ThreadStart(ticketingThread)); objthread.Start(); As i dont know when it will end. i never abort the thread. what happens is when user uses the page for 1 weeek, the page starts hanging. I dont know what happens. When i tried debugging it works fine. I also saw creating thread in threadpools ThreadPool.QueueUserWorkItem(new WaitCallback(ticketingThread)); Please advise which one i have to follow and what is the difference between the two. Thanks Venky

      M Offline
      M Offline
      MGreville
      wrote on last edited by
      #2

      Hi Venky. I have nothing to hand here, but i remember that you can use a delegate to run the thread, and then a callback function which will terminate it. Im not sure how often this thread is getting created, but even if it is only once, it is good practice to terminate the thread when it has completed its job. Cheers Mark.

      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