Extend locking in BlockingQueue to cover operations that are not guaranteed to be thread-safe