Added flags for the txn_commit function.

This commit is contained in:
Phillip Toland 2008-12-10 17:12:16 -06:00
parent f743d855d8
commit 71f64d9666
2 changed files with 13 additions and 2 deletions

View file

@ -290,6 +290,11 @@ static int bdberl_drv_control(ErlDrvData handle, unsigned int cmd,
AsyncData* adata = zalloc(sizeof(AsyncData));
adata->port = d;
if (cmd == CMD_TXN_COMMIT)
{
adata->payload = (void*) UNPACK_INT(inbuf, 0);
}
// Update port data to indicate we have an operation in progress
d->async_op = cmd;
@ -670,7 +675,8 @@ static void do_async_txnop(void* arg)
AsyncData* adata = (AsyncData*)arg;
if (adata->port->async_op == CMD_TXN_COMMIT)
{
adata->rc = adata->port->txn->commit(adata->port->txn, 0);
unsigned flags = (unsigned) adata->payload;
adata->rc = adata->port->txn->commit(adata->port->txn, flags);
}
else
{

View file

@ -300,7 +300,12 @@ txn_begin(Port, Opts) ->
end.
txn_commit(Port) ->
<<Result:32/native>> = erlang:port_control(Port, ?CMD_TXN_COMMIT, <<>>),
txn_commit(Port, []).
txn_commit(Port, Opts) ->
Flags = process_flags(Opts),
Cmd = <<Flags:32/unsigned-native>>,
<<Result:32/native>> = erlang:port_control(Port, ?CMD_TXN_COMMIT, Cmd),
case Result of
?ERROR_NONE ->
receive