yesod::counted_ptr: overhaul of implementation to enable partial atomicity (1)

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