Changeset 11022
- Timestamp:
- 03/08/10 22:42:09 (2 years ago)
- File:
-
- 1 edited
-
trunk/Padre/lib/Padre/SlaveDriver.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Padre/lib/Padre/SlaveDriver.pm
r11008 r11022 78 78 } => $class; 79 79 $SlaveDriver->_init_events; 80 81 # There is no database/locking protection 82 # here, so this must happen before we make 83 # a long-term connection to the database. 80 84 $SlaveDriver->{master} = threads->create( 81 85 \&_slave_driver_loop, … … 83 87 $SlaveDriver->{tid_queue} 84 88 ); 89 85 90 return $SlaveDriver; 86 91 } … … 213 218 last if $args eq 'STOP'; 214 219 my $task_queue = Padre::SlaveDriver->new->task_queue; 220 221 # Apply the database anti-lock, so there are no active DBI connection 222 # handles at the time we spawn the thread. 223 # If Padre::DB is not loaded at all, the following returns false and 224 # we never make the calls to the non-existant class. 225 my $locked = Padre::DB->can('connected') && Padre::DB->connected; 226 if ( $locked ) { 227 Padre::DB->commit; 228 } 229 230 # Do the actual thread spawn 215 231 my $worker_thread = threads->create( \&_worker_loop, $task_queue ); 216 my $tid = $worker_thread->tid; 217 $outqueue->enqueue($tid); 232 233 # Release the anti-lock on the database 234 if ( $locked ) { 235 Padre::DB->begin; 236 } 237 238 # Continue onwards with thready stuff 239 $outqueue->enqueue($worker_thread->tid); 218 240 } 219 241 return 1;
Note: See TracChangeset
for help on using the changeset viewer.
