Use client stop signals for thread stopping

This commit is contained in:
Alex Young
2012-06-07 14:25:30 +01:00
parent a90f84972b
commit 5930f25034
6 changed files with 121 additions and 47 deletions

View File

@@ -6,7 +6,7 @@
void error_init();
void error(int consult_errno, int close_socket, pthread_mutex_t* unlock, const char* format, ...);
void error(int consult_errno, int fatal, int close_socket, pthread_mutex_t* unlock, const char* format, ...);
void* xrealloc(void* ptr, size_t size);
@@ -21,14 +21,14 @@ void debug(const char*msg, ...);
#endif
#define CLIENT_ERROR(msg, ...) \
error(0, client->socket, &client->serve->l_io, msg, ##__VA_ARGS__)
error(0, 0, client->socket, &client->serve->l_io, msg, ##__VA_ARGS__)
#define CLIENT_ERROR_ON_FAILURE(test, msg, ...) \
if (test < 0) { error(1, client->socket, &client->serve->l_io, msg, ##__VA_ARGS__); }
if (test < 0) { error(1, 0, client->socket, &client->serve->l_io, msg, ##__VA_ARGS__); }
#define SERVER_ERROR(msg, ...) \
error(0, 0, NULL, msg, ##__VA_ARGS__)
error(0, 1, 0, NULL, msg, ##__VA_ARGS__)
#define SERVER_ERROR_ON_FAILURE(test, msg, ...) \
if (test < 0) { error(1, 0, NULL, msg, ##__VA_ARGS__); }
if (test < 0) { error(1, 1, 0, NULL, msg, ##__VA_ARGS__); }
#define NULLCHECK(x); if ( NULL == (x) ) { SERVER_ERROR( "Null " #x "." ); }