r1kon wrote on Tue, 13 December 2011 22:29 |
The other thing is I set up GuiLock __; on every write to the GUI, and it made my program verrrrryyyy slow to respond (but never crashed! lol). I think it may be due to the fact that I have some indefinite loops and the GuiLock's may be waiting for one another to complete, thus slowing everything down quite a bit. |
myFunc(){ SomeComputing(); { StillParallel(); GuiLock __; // GuiLock constructor locks gui access here UpdateGui(); } // GuiLock destructor releases the lock automatically at the end of scope SomeMoreComputing(); }
r1kon wrote on Tue, 13 December 2011 22:29 |
So, I took them all out but that one (in the workhorse thread)..so it sounds like I need to put them all back, but in a "cleaner" manor. My question now is..what is the best way to do that? Is it ONLY set to lock within the confines of the nest? For example: for(int i = 0; i < 1000; i++) { for(int z = 0; z < 1000; z++) { Sleep(1); if(something > something_else) { GuiLock __; myArr.Set(z,0,t_("Data to be written")); } something++; } } Does GuiLock in this case set and then released at the end of the if() statement? Or does it stay set through the entire for() loop? So, the same code snippit..which place would be the best to put GuiLock __;? //HERE? GuiLock __; for(int i = 0; i < 1000; i++) { //HERE? GuiLock __; for(int z = 0; z < 1000; z++) { Sleep(1); if(something > something_else) { //Or leave it here? GuiLock __; myArr.Set(z,0,t_("Data to be written")); } something++; } } |
r1kon wrote on Tue, 13 December 2011 22:29 |
I hope I'm not being annoying in asking -- I just need to make my multi-thread application as streamlined as possible without it killing the GUI responce. Thanks in advance..I really appreciate it! |