Click to See Complete Forum and Search --> : threads
dave2k
February 13th, 2006, 08:58 AM
there are 10 areas in a window where i want to scrape every second which represents the bank rolls of 10 players in a poker game. because i am doing some OCR to get the bankrolls, i am going through pixel-by-pixel which takes a while, obviuosly it takes 10 times each bank roll to do the whole lot.
i am wondering if threads would be a good approach here, i.e. have a thread for each bank roll, and then i would have 10 individual ocr operation going on at the same time, rather than 1 after the other
would this make things alot quicker?
NoHero
February 13th, 2006, 09:11 AM
Depends on your implementation. If you use to many threads, synchronization objects your program can become a hell lazier... Anyway, the task with the OCR seems to be a good case for a thread. Do they have play simultaneously?
dave2k
February 13th, 2006, 09:13 AM
they play simultaneously. basically every second my program finds out how much the current bank roll is for evey player, then by that it can work out how the action has gone, i.e. whether they have folded/checked/called etc..
i guess i could allocate an object of a class for every thread call Player or something..
NoHero
February 15th, 2006, 12:29 PM
[ Moved Thread ]
NoHero
February 15th, 2006, 12:30 PM
A thread for this OCR thing is definetley a good choice. On the other: Well depends on on if the calculation of the round takes too long, if so: You can let them precalculate their steps.
Siddhartha
February 15th, 2006, 12:54 PM
would this make things alot quicker?
Only if you are unhappy with the current performance, then, dependending on the implementation of a multithreaded system, the answer might be - yes.
However, go for a MT system as a last resort after you have ironed out all deficiencies in the current implementation, and are sure that the single threaded model can be optimized no more.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.