Could be cheaper to enqueue at head (given that it's a Doubly-linked list) instead of check-then act. (If we aren't assuming that writeSend will fail very frequently.