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

Comparing jsr166/src/jsr166y/ForkJoinPool.java (file contents):
Revision 1.30 by dl, Wed Jul 29 12:05:55 2009 UTC vs.
Revision 1.31 by dl, Wed Jul 29 22:48:54 2009 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines