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. ThreadPool Class

ThreadPool Class

Scheduled Pinned Locked Moved C#
tutorial
3 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.
  • S Offline
    S Offline
    Spiros
    wrote on last edited by
    #1

    I am using ThreadPool class and I cannot find a way to return data from the callback procedure. Does anybody have any idea how to do that. Thank for your time Spiros Prantalos Miami the place to be!!

    H D 2 Replies Last reply
    0
    • S Spiros

      I am using ThreadPool class and I cannot find a way to return data from the callback procedure. Does anybody have any idea how to do that. Thank for your time Spiros Prantalos Miami the place to be!!

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      That's what the state parameter is for. Since it's an object - and therefore a reference type - it can be used to pass both input and output arguments. If you want better handling of parameters and return values, use asynchronous methods instead (such as Begin_Whatever_ and End_Whatever_). If you use the proper signature for methods in C#, the compiler can actually create asynchronous methods for your methods. See Including Asynchronous Calls[^] in the .NET Framework SDK for more information. Also, worker threads are common associated with an object that contains the data with which the callback method operates, so if it also stores state in such properties, you can always retrieve them later when the worker thread finishes, if it finishes at all (some are designed to run continuously - it's all up to your design).

      Microsoft MVP, Visual C# My Articles

      1 Reply Last reply
      0
      • S Spiros

        I am using ThreadPool class and I cannot find a way to return data from the callback procedure. Does anybody have any idea how to do that. Thank for your time Spiros Prantalos Miami the place to be!!

        D Offline
        D Offline
        dabuskol
        wrote on last edited by
        #3

        Hi, Try this sites for ideas and information. http://www.codeproject.com/csharp/XYNetSocket.asp?target=socket|programming http://www.codeproject.com/csharp/socketsincs.asp http://www.developerfusion.com/show/3918/4/ I hope this will help you. /dabuskol

        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