@@ -248,13 +248,14 @@ void manyRegisterAndUnregisterSameTime() throws InterruptedException, IOExceptio
248248 }
249249 var r = new Thread (() -> {
250250 try {
251+ var id = Thread .currentThread ().getId ();
251252 startRegistering .acquire ();
252253 for (int k = 0 ; k < 1000 ; k ++) {
253254 var watcher = Watcher
254255 .watch (testDir .getTestDirectory (), WatchScope .PATH_AND_CHILDREN )
255256 .onEvent (e -> {
256257 if (e .calculateFullPath ().equals (target )) {
257- seen .add (Thread . currentThread (). getId () );
258+ seen .add (id );
258259 }
259260 });
260261 try (var c = watcher .start ()) {
@@ -270,7 +271,6 @@ void manyRegisterAndUnregisterSameTime() throws InterruptedException, IOExceptio
270271 } catch (InterruptedException e1 ) {
271272 }
272273 finally {
273- startedWatching .release ();
274274 done .release ();
275275 }
276276 });
@@ -280,7 +280,7 @@ void manyRegisterAndUnregisterSameTime() throws InterruptedException, IOExceptio
280280
281281 startRegistering .release (THREADS );
282282 done .acquire (THREADS - amountOfWatchersActive );
283- startedWatching .acquire (THREADS );
283+ startedWatching .acquire (amountOfWatchersActive );
284284 assertTrue (seen .isEmpty (), "No events should have been sent" );
285285 Files .writeString (target , "Hello World" );
286286 await ("We should see only exactly the " + amountOfWatchersActive + " events we expect" )
0 commit comments