X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemslap.cc;h=d32b1c040e79b6e686506dd3d06f011ae8b11c20;hb=e4feb8020e04b12017c5827be98d96f5330c60e8;hp=8b694835d37cbc6cc6f6af1a469b9457d1b28079;hpb=e229a51b6a425b7715050242afb57443afcc463d;p=awesomized%2Flibmemcached diff --git a/clients/memslap.cc b/clients/memslap.cc index 8b694835..d32b1c04 100644 --- a/clients/memslap.cc +++ b/clients/memslap.cc @@ -2,7 +2,7 @@ * * Libmemcached library * - * Copyright (C) 2011 Data Differential, http://datadifferential.com/ + * Copyright (C) 2011-2012 Data Differential, http://datadifferential.com/ * Copyright (C) 2006-2009 Brian Aker All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,7 @@ */ -#include +#include #include #include @@ -55,7 +55,7 @@ #include -#include +#include #include "client_options.h" #include "utilities.h" @@ -224,7 +224,15 @@ int main(int argc, char *argv[]) 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); @@ -233,7 +241,7 @@ int main(int argc, char *argv[]) conclusions_print(&conclusion); memcached_server_list_free(servers); - return EXIT_SUCCESS; + return error_code; } void scheduler(memcached_server_st *servers, conclusions_st *conclusion) @@ -305,7 +313,7 @@ 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); }