ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ForkJoinPool.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ForkJoinPool.java (file contents):
Revision 1.5 by jsr166, Wed Jul 29 18:23:30 2009 UTC vs.
Revision 1.6 by jsr166, Thu Jul 30 04:19:41 2009 UTC

# Line 1120 | Line 1120 | public class ForkJoinPool extends Abstra
1120      public void shutdown() {
1121          checkPermission();
1122          transitionRunStateTo(SHUTDOWN);
1123 <        if (canTerminateOnShutdown(runControl))
1123 >        if (canTerminateOnShutdown(runControl)) {
1124 >            if (workers == null) { // shutting down before workers created
1125 >                final ReentrantLock lock = this.workerLock;
1126 >                lock.lock();
1127 >                try {
1128 >                    if (workers == null) {
1129 >                        terminate();
1130 >                        transitionRunStateTo(TERMINATED);
1131 >                        termination.signalAll();
1132 >                    }
1133 >                    
1134 >                } finally {
1135 >                    lock.unlock();
1136 >                }
1137 >            }
1138              terminateOnShutdown();
1139 +        }
1140      }
1141  
1142      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines