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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. threading

threading

Scheduled Pinned Locked Moved C#
question
9 Posts 5 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
    vibhas1982
    wrote on last edited by
    #1

    How can i make the thread wait and do other task

    hello every one

    G C M L 5 Replies Last reply
    0
    • V vibhas1982

      How can i make the thread wait and do other task

      hello every one

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      Wait for what? Do you want it to do "other task" while waiting, or after waiting?

      --- single minded; short sighted; long gone;

      1 Reply Last reply
      0
      • V vibhas1982

        How can i make the thread wait and do other task

        hello every one

        C Offline
        C Offline
        Christian Graus
        wrote on last edited by
        #3

        That is kind of what you're generally avoiding when you use threads. You need to better explain what you're trying to do, it sounds like you don't want to use a thread at all.

        Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        1 Reply Last reply
        0
        • V vibhas1982

          How can i make the thread wait and do other task

          hello every one

          M Offline
          M Offline
          Manoj Kumar Rai
          wrote on last edited by
          #4

          Hi, To get this implemented you need to have a smart design. You can implement somthing like: Suppose thread #2 is waiting for thread #1 to finish the job, and you want thread #2 to do somting while its waiting for thread #1. In thread #2 implementation you can do the following: while (true) // this is the wait loop for the thread #2 { //check if thread #1 has completed its job if (yes) exit from this wait loop. else perform the task you want thread #2 to do, while waiting. //Sleep for say 0 so that others thread gets quantum }

          Manoj Never Gives up

          V 1 Reply Last reply
          0
          • V vibhas1982

            How can i make the thread wait and do other task

            hello every one

            M Offline
            M Offline
            Manoj Kumar Rai
            wrote on last edited by
            #5

            Hi, To get this implemented you need to have a smart design. You can implement somthing like: Suppose thread #2 is waiting for thread #1 to finish the job, and you want thread #2 to do somting while its waiting for thread #1. In thread #2 implementation you can do the following: while (true) // this is the wait loop for the thread #2 { //check if thread #1 has completed its job if (yes) exit from this wait loop. else perform the task you want thread #2 to do, while waiting. //Sleep for say 0 so that others thread gets quantum }

            Manoj Never Gives up

            C 1 Reply Last reply
            0
            • M Manoj Kumar Rai

              Hi, To get this implemented you need to have a smart design. You can implement somthing like: Suppose thread #2 is waiting for thread #1 to finish the job, and you want thread #2 to do somting while its waiting for thread #1. In thread #2 implementation you can do the following: while (true) // this is the wait loop for the thread #2 { //check if thread #1 has completed its job if (yes) exit from this wait loop. else perform the task you want thread #2 to do, while waiting. //Sleep for say 0 so that others thread gets quantum }

              Manoj Never Gives up

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              Manoj Kumar Rai wrote:

              while (true)

              This is smart ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

              M 1 Reply Last reply
              0
              • C Christian Graus

                Manoj Kumar Rai wrote:

                while (true)

                This is smart ?

                Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

                M Offline
                M Offline
                Manoj Kumar Rai
                wrote on last edited by
                #7

                Christian Graus wrote:

                This is smart ?

                It takes smartness to find smart:-)

                Manoj Never Gives up

                1 Reply Last reply
                0
                • M Manoj Kumar Rai

                  Hi, To get this implemented you need to have a smart design. You can implement somthing like: Suppose thread #2 is waiting for thread #1 to finish the job, and you want thread #2 to do somting while its waiting for thread #1. In thread #2 implementation you can do the following: while (true) // this is the wait loop for the thread #2 { //check if thread #1 has completed its job if (yes) exit from this wait loop. else perform the task you want thread #2 to do, while waiting. //Sleep for say 0 so that others thread gets quantum }

                  Manoj Never Gives up

                  V Offline
                  V Offline
                  vibhas1982
                  wrote on last edited by
                  #8

                  thanx manoj

                  hello every one

                  1 Reply Last reply
                  0
                  • V vibhas1982

                    How can i make the thread wait and do other task

                    hello every one

                    L Offline
                    L Offline
                    leppie
                    wrote on last edited by
                    #9

                    Look at ManualResetEvent in System.Threading.

                    **

                    xacc.ide-0.2.0.57 - now with C# 2.0 parser and seamless VS2005 solution support!

                    **

                    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