pthread_mutex_init(&sleeper_mutex, NULL);
pthread_cond_init(&sleep_threshhold, NULL);
- scheduler(servers, &conclusion);
+ int error_code= EXIT_SUCCESS;
+ try {
+ scheduler(servers, &conclusion);
+ }
+ catch(std::exception& e)
+ {
+ std::cerr << "Died with exception: " << e.what() << std::endl;
+ error_code= EXIT_FAILURE;
+ }
free(opt_servers);
conclusions_print(&conclusion);
memcached_server_list_free(servers);
- return EXIT_SUCCESS;
+ return error_code;
}
void scheduler(memcached_server_st *servers, conclusions_st *conclusion)
pthread_t *threads= new (std::nothrow) pthread_t[opt_concurrency];
- if (not threads)
+ if (threads == NULL)
{
exit(EXIT_FAILURE);
}