I’m on 7.1.27, and fdb_future_block_until_ready
is blocking forever while I’ve started the network.
This is all of my source code:
#define FDB_API_VERSION 710
#include <foundationdb/fdb_c.h>
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
void check_fdb_err(int err) {
if (err != 0) {
fprintf(stderr, fdb_get_error(err));
exit(1);
}
}
pthread_t network_thread_id;
void *run_network() {
check_fdb_err(fdb_run_network());
return NULL;
}
int main() {
check_fdb_err(fdb_select_api_version(710));
fdb_setup_network();
if (pthread_create(&network_thread_id, NULL, (void *)run_network, NULL) !=
0) {
fprintf(stderr, "Failed to create pthread.\n");
exit(1);
}
FDBDatabase *database;
check_fdb_err(fdb_create_database(NULL, &database));
FDBTransaction *transaction;
check_fdb_err(fdb_database_create_transaction(database, &transaction));
FDBFuture *future = fdb_transaction_get(transaction, "somekey", 1, 0);
check_fdb_err(fdb_future_block_until_ready(future));
fdb_transaction_destroy(transaction);
fdb_database_destroy(database);
check_fdb_err(fdb_stop_network());
}