Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

stop and restart thread  RSS feed

 
Mirza faisal
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HELLO!
i am using an array i.e
long timeArray[10]={11152,4583,3456,2345,86564};

these are the time pointers for which thread have to sleep one by one.. but the case in which i am facing problem is that while running for example thread is sleeping for 2nd element of array (4583 seconds) at that time user presses Next button now thread should leave 2nd element of array and start sleeping for 3rd element i.e (3456 seconds) ....

i have also stopped thread and start again but it creating some problems.

i have also see the working of timers i can solve my problem but i didn't got any way to dynamically assign time to schedule function..

this could clear problem
timer.schedule(myTask,0,1000);
but i want
timer.schedule(myTask,0,timeArray[i]);

please help me ........

thanks in advance.......
[ November 20, 2008: Message edited by: Mirza faisal ]
 
Henry Wong
author
Sheriff
Posts: 22840
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe that there is something that does exactly what you want -- but it shouldn't be that hard to write one yourself. You will have to implement your own timer, that uses the array.

Sorry...
Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!