Skip to content
This repository has been archived by the owner on Oct 19, 2020. It is now read-only.

Commit

Permalink
Fixed awaiting void futures
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeSapkin committed Feb 9, 2015
1 parent d5f6670 commit 77fe196
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 2 additions & 0 deletions source/fdb/future.d
Expand Up @@ -153,6 +153,8 @@ shared class FDBFutureBase(C, V) : FutureBase!V, IDisposable

static if (!is(V == void))
value = cast(shared)extractValue(fh, err);
else
extractValue(fh, err);

exception = cast(shared)err.toException;

Expand Down
4 changes: 0 additions & 4 deletions source/fdb/main.d
@@ -1,18 +1,14 @@
module fdb.main;

import
std.array,
std.concurrency,
std.conv,
std.exception,
std.format,
std.string;

import
fdb.cluster,
fdb.error,
fdb.fdb_c,
fdb.fdb_c_options,
fdb.future,
fdb.networkoptions;

Expand Down
10 changes: 3 additions & 7 deletions source/fdb/transaction.d
Expand Up @@ -159,13 +159,9 @@ shared class Transaction : IDatabaseContext, IDisposable, IReadOnlyTransaction
// cancel, commit and reset are mutually exclusive
synchronized (this)
{
auto fh = fdb_transaction_commit(cast(TransactionHandle)th);

auto err = fdb_future_block_until_ready(fh);
enforceError(err);

err = fdb_future_get_error(fh);
enforceError(err);
auto fh = fdb_transaction_commit(cast(TransactionHandle)th);
auto future = createFuture!VoidFuture(fh, this);
future.await;
}
}

Expand Down

0 comments on commit 77fe196

Please sign in to comment.