Bob The Builder 62 Posted August 22, 2011 Report Share Posted August 22, 2011 I'm having a hard time figuring out how to do this. I load a csv file to a table, and loop for each row in the file. I am trying to use threading and in new browser to give each row a unique thread for parallel processing and a unique browser. The problem is the variable I use to keep track of which row I am on is set to 0 outside of the loop at the start. If i put it in the loop, it will keep getting reset. If I put it outside, the threads run at the same time and will run as "0" together. What I need to know, how can I create an incremental variable that works across many threads to keep track of which position the thread is working off. Kind of like a ticket stub at a deli counter. I basically need a thread safe sequence counter. I am incrementing the variable at the end of the thread because that is how I had it before I introduced threads. It worked great till I started monkeying with threads. Quote Link to post Share on other sites
Bob The Builder 62 Posted August 27, 2011 Author Report Share Posted August 27, 2011 I think I have this figured out. Doing some more testing. Quote Link to post Share on other sites
Bob The Builder 62 Posted August 27, 2011 Author Report Share Posted August 27, 2011 Works like a champ. Quote Link to post Share on other sites
Choller 3 Posted September 6, 2011 Report Share Posted September 6, 2011 Care to share? I can't figure threading out. I want to sign up to different wordpress sites. Going single threaded takes a few hours :/ Quote Link to post Share on other sites
Bob The Builder 62 Posted September 6, 2011 Author Report Share Posted September 6, 2011 Care to share? I can't figure threading out. I want to sign up to different wordpress sites. Going single threaded takes a few hours :/ I was doing the following: variable counterloopcodeincrementend loop What I found out, is I need to do variable functioncodeincrement variable loopcall function Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.