Solve possible race in semaphor creation
Solve possible race in semaphor creation

Solve the race condition described in the bug 872558 report which can
result in:

- thread crashing trying to remove semaphore from dict
- two threads getting different semaphores for the same name

First case is solved automatically by weakref dictionary. No explicit
deletion takes place.
The second case is solved by getting existing or new semaphore in one
step. Once a local reference to the semaphore is obtained, it can be
safely assigned to the dictionary if it's missing. If it's present, it
will not be removed anymore because there's at least one strong
reference present (local variable 'sem').

This solution is only valid for greenthreads.

Change-Id: I6bddc3e7abb39fd75e1f03abb2ea0f911b761957

n0ano/gantt,n0ano/gantt