~rogpeppe/gozk/factor-out-service

« back to all changes in this revision

Viewing changes to helpers.h

  • Committer: Gustavo Niemeyer
  • Date: 2011-01-11 12:58:26 UTC
  • Revision ID: gustavo@niemeyer.net-20110111125826-g4y4nxazf91x9q7o
Moved helpers into their own .c file, included via header.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef helpers_h
 
2
#define helpers_h 1
 
3
 
 
4
#include <zookeeper.h>
 
5
#include <pthread.h>
 
6
 
 
7
typedef struct _watch_data {
 
8
    int connection_state;
 
9
    int event_type;
 
10
    char *event_path;
 
11
    void *watch_context;
 
12
    struct _watch_data *next;
 
13
} watch_data;
 
14
 
 
15
typedef struct _completion_data {
 
16
    pthread_mutex_t mutex;
 
17
    void *data;
 
18
} completion_data;
 
19
 
 
20
completion_data* create_completion_data();
 
21
void destroy_completion_data(completion_data *data);
 
22
void wait_for_completion(completion_data *data);
 
23
 
 
24
watch_data *wait_for_watch();
 
25
void destroy_watch_data(watch_data *data);
 
26
 
 
27
// Cgo doesn't like to use function addresses as variables.
 
28
extern watcher_fn watch_handler;
 
29
extern void_completion_t handle_void_completion;
 
30
 
 
31
#endif
 
32
 
 
33
// vim:ts=4:sw=4:et