HEX
Server: Apache
System: Linux s198.coreserver.jp 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC 2025 x86_64
User: nagasaki (10062)
PHP: 7.1.33
Disabled: NONE
Upload Files
File: //usr/local/rvm/gems/ruby-2.6.8/doc/concurrent-ruby-1.1.9/ri/Concurrent/atomically-c.ri
U:RDoc::AnyMethod[iI"atomically:ETI"Concurrent::atomically;TT:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[I"ORun a block that reads and writes `TVar`s as a single atomic transaction. ;TI"PWith respect to the value of `TVar` objects, the transaction is atomic, in ;TI"Kthat it either happens or it does not, consistent, in that the `TVar` ;TI"Oobjects involved will never enter an illegal state, and isolated, in that ;TI"Ktransactions never interfere with each other. You may recognise these ;TI"+properties from database transactions.;To:RDoc::Markup::BlankLineo;
;	[I"SThere are some very important and unusual semantics that you must be aware of:;T@o:RDoc::Markup::List:
@type:BULLET:@items[	o:RDoc::Markup::ListItem:@label0;	[o;
;	[I"LMost importantly, the block that you pass to atomically may be executed;To:RDoc::Markup::Verbatim;	[I"?more than once. In most cases your code should be free of
;TI"(side-effects, except for via TVar.
;T:@format0o;;0;	[o;
;	[I"OIf an exception escapes an atomically block it will abort the transaction.;T@o;;0;	[o;
;	[I"FIt is undefined behaviour to use callcc or Fiber with atomically.;T@o;;0;	[o;
;	[I"LIf you create a new thread within an atomically, it will not be part of;To;;	[I"Athe transaction. Creating a thread counts as a side-effect.
;T;0o;
;	[I"LTransactions within transactions are flattened to a single transaction.;T@o;
;	[I"
@example;To;;	[I"a = new TVar(100_000)
;TI"b = new TVar(100)
;TI"
;TI"Concurrent::atomically do
;TI"  a.value -= 10
;TI"  b.value += 10
;TI"end;T;0:
@fileI"+lib/concurrent-ruby/concurrent/tvar.rb;T:0@omit_headings_from_table_of_contents_below00I";T[I"();T@CFI"Concurrent;TcRDoc::NormalModule00