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/Atom/swap-i.ri
U:RDoc::AnyMethod[iI"	swap:ETI"Concurrent::Atom#swap;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph;	[
I"KAtomically swaps the value of atom using the given block. The current ;TI"Hvalue will be passed to the block, as will any arguments passed as ;TI"Larguments to the function. The new value will be validated against the ;TI"N(optional) validator proc given at construction. If validation fails the ;TI"value will not be changed.;To:RDoc::Markup::BlankLineo;
;	[I"OInternally, {#swap} reads the current value, applies the block to it, and ;TI"Nattempts to compare-and-set it in. Since another thread may have changed ;TI"Othe value in the intervening time, it may have to retry, and does so in a ;TI"Nspin loop. The net effect is that the value will always be the result of ;TI"Kthe application of the supplied block to a current value, atomically. ;TI"PHowever, because the block might be called multiple times, it must be free ;TI"of side effects.;T@o;
;	[I"P@note The given block may be called multiple times, and thus should be free;To:RDoc::Markup::Verbatim;	[I"of side effects.
;T:@format0o;
;	[I"E@param [Object] args Zero or more arguments passed to the block.;T@o;
;	[I"J@yield [value, args] Calculates a new value for the atom based on the;To;;	[I"/current value and any supplied arguments.
;T;
0o;
;	[I"?@yieldparam value [Object] The current value of the atom. ;TI"O@yieldparam args [Object] All arguments passed to the function, in order. ;TI">@yieldreturn [Object] The intended new value of the atom.;T@o;
;	[I"J@return [Object] The final value of the atom after all operations and;To;;	[I"validations are complete.
;T;
0o;
;	[I"3@raise [ArgumentError] When no block is given.;T:
@fileI"+lib/concurrent-ruby/concurrent/atom.rb;T:0@omit_headings_from_table_of_contents_below00I"old_value, *args;T[I"(*args);T@9FI"	Atom;TcRDoc::NormalClass00