X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=clients%2Fmemslap.cc;h=d32b1c040e79b6e686506dd3d06f011ae8b11c20;hb=497e060941ba1d5829f54f84eb380c28fbf34c66;hp=a8c0da1ed7b61a531dbbe66cbc86682eae2b22e6;hpb=920b0f21e75bb5b145a7de7383f5ae8c4a2c358a;p=awesomized%2Flibmemcached diff --git a/clients/memslap.cc b/clients/memslap.cc index a8c0da1e..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" @@ -159,7 +159,7 @@ test_t opt_test= SET_TEST; extern "C" { -static void *run_task(void *p) +static __attribute__((noreturn)) void *run_task(void *p) { thread_context_st *context= (thread_context_st *)p; @@ -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); }