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. threading

threading

Scheduled Pinned Locked Moved C#
helptutorial
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
    sajjy
    wrote on last edited by
    #1

    hi guys i dont know how to make thread in my program , please help me :) i wanna know how to make , and work with threads , it`s better to use System.threading.thread :cool:

    L P 2 Replies Last reply
    0
    • S sajjy

      hi guys i dont know how to make thread in my program , please help me :) i wanna know how to make , and work with threads , it`s better to use System.threading.thread :cool:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Use google to find information about threading, there are thousands of that. Beginners Guide To Threading In .NET Part 1 of n[^]

      1 Reply Last reply
      0
      • S sajjy

        hi guys i dont know how to make thread in my program , please help me :) i wanna know how to make , and work with threads , it`s better to use System.threading.thread :cool:

        P Offline
        P Offline
        Paulo Zemek
        wrote on last edited by
        #3

        Thread myThread = new Thread(nameOfTheFunctionToExecuteHere); myThread.Start(); This is enough to create a new thread and start it. You can, of course, set the name of the thread, the priority etc. The nameOfTheFunctionToExecuteHere must be in the pattern: void nameOfTheFunctionToExecuteHere() { } or static void nameOfTheFunctionToExecuteHere() { } You can also use void nameOfTheFunctionToExecuteHere(object parameter) but, in that case, you must call myThread.Start(parameter). This will create an entire new thread. For small work that does not wait for any external events it is recommented that you use the ThreadPool. To do that, call ThreadPool.QueueUserWorkItem(methodNameHere); This will use reutilize the threads from the ThreadPool (it is faster than creating a full thread), but the ThreadPool is limited, so you must not "block undefinitelly" in these threads. There are other differences, but I think you will find it by yourself.

        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