Gestionnaire de fichiers - Editer - /opt/cpanel/ea-ruby24/root/usr/share/ri/system/File/flock-i.ri
Arrière
U:RDoc::AnyMethod[iI" flock:ETI"File#flock;TF:publico:RDoc::Markup::Document:@parts[ o:RDoc::Markup::Paragraph; [ I"ELocks or unlocks a file according to <i>locking_constant</i> (a ;TI"<logical <em>or</em> of the values in the table below). ;TI"AReturns <code>false</code> if <code>File::LOCK_NB</code> is ;TI"Cspecified and the operation would otherwise have blocked. Not ;TI" available on all platforms.;To:RDoc::Markup::BlankLine o; ; [I"'Locking constants (in class File):;T@o:RDoc::Markup::Verbatim; [I">LOCK_EX | Exclusive lock. Only one process may hold an ;TI"< | exclusive lock for a given file at a time. ;TI"A----------+------------------------------------------------ ;TI";LOCK_NB | Don't block when locking. May be combined ;TI"; | with other lock options using logical or. ;TI"A----------+------------------------------------------------ ;TI"ALOCK_SH | Shared lock. Multiple processes may each hold a ;TI"@ | shared lock for a given file at the same time. ;TI"A----------+------------------------------------------------ ;TI"LOCK_UN | Unlock. ;T:@format0o; ; [I" Example:;T@o;; [I")# update a counter using write lock ;TI"@# don't use "w" because it truncates the file before lock. ;TI"=File.open("counter", File::RDWR|File::CREAT, 0644) {|f| ;TI" f.flock(File::LOCK_EX) ;TI" value = f.read.to_i + 1 ;TI" f.rewind ;TI" f.write("#{value}\n") ;TI" f.flush ;TI" f.truncate(f.pos) ;TI"} ;TI" ;TI"(# read the counter using read lock ;TI"$File.open("counter", "r") {|f| ;TI" f.flock(File::LOCK_SH) ;TI" p f.read ;TI"};T; 0: @fileI"file.c;T:0@omit_headings_from_table_of_contents_below0I"0file.flock(locking_constant) -> 0 or false ;T0[ I" (p1);T@7FI" File;TcRDoc::NormalClass00
| ver. 1.4 |
Github
|
.
| PHP 8.0.30 | Génération de la page: 0.01 |
proxy
|
phpinfo
|
Réglages