Enable locking on an evbuffer so that it can safely be used by multiple
threads at the same time.
NOTE: when locking is enabled, the lock will be held when callbacks are
invoked. This could result in deadlock if you aren't careful. Plan
accordingly!
@param buf An evbuffer to make lockable.
@param lock A lock object, or NULL if we should allocate our own.
@return 0 on success, -1 on failure.
Enable locking on an evbuffer so that it can safely be used by multiple threads at the same time.
NOTE: when locking is enabled, the lock will be held when callbacks are invoked. This could result in deadlock if you aren't careful. Plan accordingly!
@param buf An evbuffer to make lockable. @param lock A lock object, or NULL if we should allocate our own. @return 0 on success, -1 on failure.