mirror of
https://github.com/matrix-construct/construct
synced 2024-11-05 13:28:54 +01:00
ircd:Ⓜ️:vm: Partial revert of a35328f38; remove mutex; use sequencing.
This commit is contained in:
parent
ee3dcf5075
commit
ec4c6c46ac
3 changed files with 6 additions and 15 deletions
|
@ -37,7 +37,6 @@ namespace ircd::m::vm
|
|||
namespace ircd::m::vm::sequence
|
||||
{
|
||||
extern ctx::dock dock;
|
||||
extern ctx::mutex mutex;
|
||||
extern uint64_t retired; // already written; always monotonic
|
||||
extern uint64_t committed; // pending write; usually monotonic
|
||||
extern uint64_t uncommitted; // evaluating; not monotonic
|
||||
|
|
|
@ -1536,9 +1536,6 @@ ircd::m::vm::eval::operator()(const event &event)
|
|||
// sequence
|
||||
//
|
||||
|
||||
decltype(ircd::m::vm::sequence::mutex)
|
||||
ircd::m::vm::sequence::mutex;
|
||||
|
||||
decltype(ircd::m::vm::sequence::dock)
|
||||
ircd::m::vm::sequence::dock;
|
||||
|
||||
|
|
|
@ -949,6 +949,12 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
assert(sequence::committed < sequence::get(eval));
|
||||
assert(sequence::retired < sequence::get(eval));
|
||||
sequence::committed = sequence::get(eval);
|
||||
if(m::exists(event_id) && !opts.replays)
|
||||
throw error
|
||||
{
|
||||
fault::EXISTS, "Write commit rejected :Event has already been evaluated."
|
||||
};
|
||||
|
||||
if(opts.write)
|
||||
write_prepare(eval, event);
|
||||
|
||||
|
@ -963,17 +969,6 @@ ircd::m::vm::execute_pdu(eval &eval,
|
|||
// Commit the transaction to database iff this eval is at the stack base.
|
||||
if(opts.write && !eval.sequence_shared[0])
|
||||
{
|
||||
const std::lock_guard lock
|
||||
{
|
||||
sequence::mutex
|
||||
};
|
||||
|
||||
if(m::exists(event_id) && !opts.replays)
|
||||
throw error
|
||||
{
|
||||
fault::EXISTS, "Write commit rejected :Event has already been evaluated."
|
||||
};
|
||||
|
||||
write_commit(eval);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue