⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.133
Server IP:
185.119.109.197
Server:
Linux managedhosting.chostar.me 5.15.0-160-generic #170-Ubuntu SMP Wed Oct 1 10:06:56 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.1.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
ri
/
3.0.0
/
system
/
File
/
View File Name :
flock-i.ri
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
locking_constant
(a ;TI"
or of the values in the table below). ;TI"FReturns
false
if File::LOCK_NB is specified and the ;TI"Boperation would otherwise have blocked. Not available on all ;TI"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