finished custom mutex implementation