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

static method in thread  RSS feed

 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to change a process to multiple thread. There is a static singleton method used in each process. There are multiple sub class of process runs.

How could I change the static method to let the sub process use the variable id locallly in multiple thread and with small change?
Thanks,


the original code like:

for (int id=0; id < length; id ++) {
staticMethod.setId(id);
for (int j= 0 ; j < process_length; j ++) {
process.work();
}
)

id will be used in work method of process and retrieved from static method
[ August 31, 2005: Message edited by: Steve Jiang ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is your question?
 
Steve Jiang
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I updated the description of question on the first post. let me know if more ifnormation is needed.

Thanks,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!