So the proper thing to do would be :

```ruby
begin
  attachment = queue.pop(true)
rescue ThreadError => te
  break if te.message == "queue empty"
  raise
end
```

I feel bad examining the message of the exception to check whether it's expected or not, but I can't see a better way.