08.12.2015 17:45, Vlad Khorsun wrote: > I see no races there. Especially considering another flags.
Yeah, my bad. > This code must not set DBB_sweep_starting flag if it not going to start > sweep thread. > I.e. if sweep thread: > - already starting In this case flag DBB_sweep_starting is already set and second attempt to do that won't hurt. > - already started In this case flag DBB_sweep_in_progress is already set and cleanSweepFlags() is going to be run afterward. > - not allowed due to database shutdown That make sense. > With your proposed simplification, code will set DBB_sweep_starting flag > in any case, > even if this thread will not continue. Thus your code is not equal to code > above and > not correct. Yes, agree. Check for shutdown should be performed before that. > Note, cleanSweepFlags() is never called after > Database::allowSweepThread(). It is called after > another method - Database::allowSweepRun() Which is called after allowSweepThread(). Total sequence is: 1) allowSweepThread() set DBB_sweep_starting 2) allowSweepRun() set DBB_sweep_in_progress and clear DBB_sweep_starting 3) cleanSweepFlags() clear both. One question: what will be wrong if allowSweepRun() don't clear DBB_sweep_starting? -- WBR, SD. ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 Firebird-Devel mailing list, web interface at https://lists.sourceforge.net/lists/listinfo/firebird-devel