WQ: catch memory allocation failures before access

Also, print debug/error messages where the failures are first caught.
Clean up WQ_RESULT_* codes. Expose them to user.
The WQ_RESULT_* codes will only signal app-level failures.
Remove WQ_RESULT_FUNCTION_FAIL.
We already return the task exit code as return_status. So the application can
check to see if the return_status indicates task execution failure.
Update the local data structure when we evict files from the worker's cache.
Fix segfault when worker sends an available results message and terminates.
The segfault happens because WQ does not remove the worker from the list of
workers with available results.

To make the removal in O(1) use a hash table instead of a list.
Remove double initialization.