test_compare(MEMCACHED_SUCCESS,
memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_TCP_NODELAY, true));
-#ifdef NOT_YET
+#if 0
test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE, 20 * 1024576));
test_compare(MEMCACHED_SUCCESS, memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE, 20 * 1024576));
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE);
getter = memcached_behavior_get(memc, MEMCACHED_BEHAVIOR_SOCKET_RECV_SIZE);
- for (x= 0, errors= 0; total < 20 * 1024576 ; x++)
+ for (x= 0, errors= 0; total < 20 * 1024576 ; x++);
#endif
size_t total_value_length= 0;
test_return_t enable_cas(memcached_st *memc)
{
- unsigned int set= 1;
-
if (libmemcached_util_version_check(memc, 1, 2, 4))
{
- memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, set);
+ memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_SUPPORT_CAS, true);
return TEST_SUCCESS;
}
{
Error << "poll() failed with:" << strerror(errno);
}
+ test_zero(active_fd);
+
set_running(false);
}
case READING:
if (operation->has_response())
{
- size_t total_read;
ssize_t read_length;
do
}
operation->push(buffer, static_cast<size_t>(read_length));
- total_read+= static_cast<size_t>(read_length);
} while (more_to_read());
} // end has_response
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
namespace datadifferential {
namespace util {
}
}
+ int oflags= O_CREAT|O_WRONLY|O_TRUNC;
+#ifdef HAVE_O_CLOEXEC
+ oflags= oflags | O_CLOEXEC;
+#endif
+
int file;
- if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) < 0)
+ if ((file = open(_filename.c_str(), oflags, S_IRWXU|S_IRGRP|S_IROTH)) < 0)
{
std::stringstream error_stream;
error_stream << "Could not open pid file for writing: " << _filename << "(" << strerror(errno) << ")";
assert(sigismember(&set, SIGUSR2));
}
+void SignalThread::sighup(signal_callback_fn* arg)
+{
+ _sighup= arg;
+}
+
+void SignalThread::sighup()
+{
+ if (_sighup)
+ {
+ _sighup();
+ }
+}
+
SignalThread::~SignalThread()
{
if (not is_shutdown())
case SIGUSR2:
break;
+ case SIGHUP:
+ context->sighup();
+ break;
+
case SIGABRT:
case SIGINT:
case SIGQUIT:
SignalThread::SignalThread(bool exit_on_signal_arg) :
_exit_on_signal(exit_on_signal_arg),
magic_memory(MAGIC_MEMORY),
- thread(pthread_self())
+ __shutdown(SHUTDOWN_RUNNING),
+ thread(pthread_self()),
+ _sighup(NULL)
{
pthread_mutex_init(&shutdown_mutex, NULL);
sigemptyset(&set);
#include <signal.h>
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef void (signal_callback_fn)();
+
+#ifdef __cplusplus
+}
+#endif
+
namespace datadifferential {
namespace util {
uint64_t magic_memory;
volatile shutdown_t __shutdown;
pthread_mutex_t shutdown_mutex;
- pthread_t thread;
public:
void set_shutdown(shutdown_t arg);
bool is_shutdown();
shutdown_t get_shutdown();
+
+ void sighup();
+ void sighup(signal_callback_fn* arg);
+
+private:
+ pthread_t thread;
+ signal_callback_fn* _sighup;
};
} /* namespace util */