File: future.h.template

package info (click to toggle)
mongo-c-driver 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 47,088 kB
  • sloc: ansic: 193,670; python: 7,780; cpp: 1,493; sh: 659; makefile: 78
file content (44 lines) | stat: -rw-r--r-- 1,002 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef FUTURE_H
#define FUTURE_H

#include <bson/bson.h>

#include "mock_server/future-value.h"
#include <mongoc/mongoc-thread-private.h>

{{ header_comment }}

typedef struct
{
   bool             resolved;
   bool             awaited;
   future_value_t   return_value;
   int              argc;
   future_value_t  *argv;
   mongoc_cond_t    cond;
   bson_mutex_t     mutex;
   bson_thread_t    thread;
} future_t;

future_t *future_new (future_value_type_t return_type, int argc);

future_value_t *future_get_param (future_t *future, int i);

void future_start (future_t *future,
                   BSON_THREAD_FUN_TYPE (start_routine));

void future_resolve (future_t *future, future_value_t return_value);

bool future_wait (future_t *future);
bool future_wait_max (future_t *future, int64_t timeout_ms);

void future_get_void (future_t *future);

{% for T in type_list %}
{{ T }}
future_get_{{ T }} (future_t *future);
{% endfor %}

void future_destroy (future_t *future);

#endif /* FUTURE_H */