Fixing a bug with releaseDetach that never detaches the semaphore

releaseDetach was always adding to number of attached permits, when it
should be decrementing it. The permits delta required for attachDetach
is always the negated number of permits that you're releasing on the
semaphore.
Revert "Fixing a bug with releaseDetach that never detaches the semaphore"

This reverts commit c3ed206321e5e50d7a26c49dba2985a95faf60b8.
releaseDetach that never detaches the semaphore

releaseDetach was always adding to number of attached permits, when it
should be decrementing it. The permits delta required for attachDetach
is always the negated number of permits that you're releasing on the
semaphore.
Revert "releaseDetach that never detaches the semaphore"

This reverts commit c352259a48d8176304a3dd77e2811cde1da6a144.
Fixing a bug with releaseDetach that never detaches the semaphore

releaseDetach was always adding to number of attached permits, when it
should be decrementing it. The permits delta required for attachDetach
is always the negated number of permits that you're releasing on the
semaphore.