thread-safe and re-entrant double-ended queue (linked list) implementation