Changeset 215166 in webkit
- Timestamp:
- Apr 9, 2017 2:48:06 PM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r215163 r215166 1 2017-04-09 Fujii Hironori <Hironori.Fujii@sony.com> 2 3 generate-bindings-all.pl shouldn't use Perl threads 4 https://bugs.webkit.org/show_bug.cgi?id=170106 5 6 Reviewed by Yusuke Suzuki. 7 8 The use of interpreter-based threads in Perl is officially 9 discouraged and not all Linux distributions and BSD compile Perl 10 with threads support. Use fork instead of threads to run 11 generate-bindings.pl in parallel. 12 13 * bindings/scripts/generate-bindings-all.pl: 14 (spawnGenerateBindingsIfNeeded): Added. 15 (executeCommand): Removed the workaround for Cygwin Perl threads. 16 (spawnCommand): Added. 17 (worker): Deleted. 18 1 19 2017-04-09 Said Abou-Hallawa <sabouhallawa@apple.com> 2 20 -
trunk/Source/WebCore/bindings/scripts/generate-bindings-all.pl
r208220 r215166 33 33 use File::Find; 34 34 use Getopt::Long; 35 use threads;36 use threads::shared;37 use Thread::Queue;38 35 39 36 my $perl = $^X; … … 122 119 needsUpdate(\@output, \@deps); 123 120 }}, @idlFiles; 124 my $queue = Thread::Queue->new(@idlFilesToUpdate); 125 my $abort :shared= 0;121 122 my $abort = 0; 126 123 my $totalCount = @idlFilesToUpdate; 127 my $currentCount :shared = 0; 128 129 my @threadPool = map { threads->create(\&worker) } (1 .. $numOfJobs); 130 $_->join for @threadPool; 124 my $currentCount = 0; 125 126 spawnGenerateBindingsIfNeeded() for (1 .. $numOfJobs); 127 while (waitpid(-1, 0) != -1) { 128 if ($?) { 129 $abort = 1; 130 } 131 spawnGenerateBindingsIfNeeded(); 132 } 131 133 exit $abort; 132 134 … … 158 160 } 159 161 160 sub worker { 161 while (my $file = $queue->dequeue_nb()) { 162 last if $abort; 163 eval { 164 $currentCount++; 165 my $basename = basename($file); 166 printProgress("[$currentCount/$totalCount] $basename"); 167 executeCommand($perl, @args, $file) == 0 or die; 168 }; 169 if ($@) { 170 $abort = 1; 171 die; 172 } 173 } 162 sub spawnGenerateBindingsIfNeeded 163 { 164 return if $abort; 165 return unless @idlFilesToUpdate; 166 my $file = shift @idlFilesToUpdate; 167 $currentCount++; 168 my $basename = basename($file); 169 printProgress("[$currentCount/$totalCount] $basename"); 170 my $pid = spawnCommand($perl, @args, $file); 171 $abort = 1 unless defined $pid; 174 172 } 175 173 … … 197 195 sub executeCommand 198 196 { 199 if ($^O eq 'cygwin') {200 # 'system' of Cygwin Perl doesn't seem thread-safe201 my $pid = fork();202 defined($pid) or die;203 if ($pid == 0) {204 exec(@_) or die;205 }206 waitpid($pid, 0);207 return $?;208 }209 197 if ($^O eq 'MSWin32') { 210 198 return system(quoteCommand(@_)); 211 199 } 212 200 return system(@_); 201 } 202 203 sub spawnCommand 204 { 205 my $pid = fork(); 206 if ($pid == 0) { 207 @_ = quoteCommand(@_) if ($^O eq 'MSWin32'); 208 exec(@_); 209 die "Cannot exec"; 210 } 211 return $pid; 213 212 } 214 213
Note: See TracChangeset
for help on using the changeset viewer.