yesod::counted_ptr: "test and set" stored pointer locking

Signed-off-by: Alex Dubov <oakad@yahoo.com>