return "{$this->lockDir}/{$hash}.lock";
}
+ /**
+ * Make sure remaining locks get cleared for sanity
+ */
function __destruct() {
- // Make sure remaining locks get cleared for sanity
- foreach ( $this->locksHeld as $path => $locks ) {
- $this->doSingleUnlock( $path, self::LOCK_EX );
- $this->doSingleUnlock( $path, self::LOCK_SH );
+ while ( count( $this->locksHeld ) ) {
+ foreach ( $this->locksHeld as $path => $locks ) {
+ $this->doSingleUnlock( $path, self::LOCK_EX );
+ $this->doSingleUnlock( $path, self::LOCK_SH );
+ }
}
}
}