rwlock_destroy destroys the reader-writer lock pointed to by lock.
This includes invalidating the lock and freeing any
associated dynamically allocated resources.
lock must previously have been initialized
(see rwlock_init(3synch)).
Parameters
lock
pointer to the lock to be destroyed
Return values
rwlock_destroy returns zero for success
and an error number for failure.
Errors
If any of the following conditions is detected,
rwlock_destroy returns the corresponding value:
EBUSY
lock is locked
or another thread is waiting to acquire lock