mardi 29 août 2017

c# thread work every 1 second and send even

i want to create a thread that will work every 1 second , when it finish(when i get true) it will send event for another object.

something like

fun(run on another thread)
{
       while true
          if(cond==true)
          {      send event
                 break
                 finish the thread
          }
          else
         sleep(1000)(and to the function again

}

the another object will do something when it get the even that the function return true and the thread finish

i think the threadpool it best here.

but i not success to write simple code on c# to implement it

please help me

Aucun commentaire:

Enregistrer un commentaire