pthread: add freelock & freelock; use assertions
add chanfree