ReentrantSynchronizedException constructor

ReentrantSynchronizedException([
  1. String? message,
  2. Object? cause
])

Exception thrown when a synchronized block is reentered from the same zone.

This exception is thrown when a synchronized block is entered from the same zone multiple times, which is not allowed.

Example

try {
  synchronized(() {
    // Do something
  });
} catch (e) {
  if (e is ReentrantSynchronizedException) {
    print('Synchronized block reentered from the same zone');
  }
}

Implementation

ReentrantSynchronizedException([String? message, Object? cause]) : super(
  message ?? 'Synchronized block reentered from the same zone', cause: cause
);