added ifdefs to connection.h and server.h; documented mutexes

personal/stbuehler/wip
Thomas Porzelt 15 years ago
parent 9858f4ee66
commit d10756d047

@ -1,3 +1,5 @@
#ifndef _LIGHTTPD_CONNECTION_H_
#define _LIGHTTPD_CONNECTION_H_
struct connection {
@ -14,3 +16,5 @@ struct connection {
struct log_t *log;
gint log_level;
};
#endif

@ -71,15 +71,15 @@ int main(int argc, char *argv[]) {
//srv->log_stderr = log_new(srv, LOG_TYPE_FILE, g_string_new("lightytest.log"));
log_write_(srv, NULL, LOG_LEVEL_WARNING, "test %s", "foo1");
log_write_(srv, NULL, LOG_LEVEL_WARNING, "test %s", "foo1");
log_write_(srv, NULL, LOG_LEVEL_WARNING, "test %s", "foo2");
log_warning(srv, NULL, "test %s", "foo1"); /* duplicate won't be logged */
log_warning(srv, NULL, "test %s", "foo2");
log_debug(srv, NULL, "test %s", "message");
log_thread_start(srv);
sleep(3);
log_error(srv, NULL, "error %d", 23);
g_atomic_int_set(&srv->rotate_logs, TRUE);
log_write_(srv, NULL, LOG_LEVEL_WARNING, "test %s", "foo3");
log_write_(srv, NULL, LOG_LEVEL_WARNING, "test %s", "foo4");
log_warning(srv, NULL, "test %s", "foo3");
log_warning(srv, NULL, "test %s", "foo4");
g_atomic_int_set(&srv->exiting, TRUE);
log_thread_wakeup(srv);

@ -1,4 +1,5 @@
#ifndef _LIGHTTPD_SERVER_H_
#define _LIGHTTPD_SERVER_H_
struct server {
guint version;
@ -10,7 +11,7 @@ struct server {
gpointer *option_def_values;
gboolean exiting;
GMutex *mutex;
GMutex *mutex; /* general mutex for accessing the various members */
/* logs */
gboolean rotate_logs;
@ -19,10 +20,12 @@ struct server {
struct log_t *log_syslog;
GAsyncQueue *log_queue;
GThread *log_thread;
GMutex *log_mutex;
GMutex *log_mutex; /* manage access for the logs hashtable */
};
server* server_new();
void server_free(server* srv);
#endif

Loading…
Cancel
Save