File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed
Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -3309,8 +3309,20 @@ restart:;
33093309 }
33103310 goto intercepted ;
33113311 }
3312+ /* This has always been commented. Indeed no lock is held here. */
33123313/* UNLOCK(thr->lock); */
3313- if ( numbusy > 0 ) return (1 ); /* Wait a bit.... */
3314+ if ( numbusy > 0 ) {
3315+ /* JD: this avoids large runtimes for tform tests under valgrind.
3316+ What seems to happen is we return from here, goto Finalize, and
3317+ end up in LoadReadjusted again without the threads having a
3318+ chance to update their busy status. Then we end up here again.
3319+ Sleep the thread for, say, 1us to allow threads to aquire the lock. */
3320+ struct timespec sleeptime ;
3321+ sleeptime .tv_sec = 0 ;
3322+ sleeptime .tv_nsec = 1000L ;
3323+ nanosleep (& sleeptime , NULL );
3324+ return (1 ); /* Wait a bit.... */
3325+ }
33143326 return (0 );
33153327intercepted :;
33163328/*
@@ -3319,8 +3331,9 @@ intercepted:;
33193331 2: find the first untreated term.
33203332 3: put the terms in the free buckets.
33213333
3322- Remember: we have the lock to avoid interference from the thread
3323- that is being robbed.
3334+ Remember: we still have the lock to avoid interference from the thread
3335+ that is being robbed. We were holding it and then jumped here with
3336+ goto intercepted.
33243337*/
33253338 numinput = thr -> firstterm + thr -> usenum ;
33263339 nperbucket = numtogo / numfree ;
You can’t perform that action at this time.
0 commit comments