#!/usr/bin/perl
#use Mooix::Thing;
#use Fcntl q{:flock};
run sub {
	my $this=shift;

	if ($this->candestroy) {
		# To prevent anything racing the loop below and adding
		# items to the container, set the maxweight to -1.
		$this->maxweight(-1);
		# Move contents out of container.
		if ($this->location) {
			foreach my $obj (grep ref, $this->contents->list) {
				my $lock=$obj->getlock(LOCK_EX | LOCK_NB);
				return 1 unless $lock; # failure
				$obj->drop(to => $this->location);
			}
		}
		return $this->super(@_);
	}
	else {
		return 1; # fail
	}
}
