⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.116
Server IP:
78.40.11.138
Server:
Linux tango.o2switch.net 4.18.0-553.30.1.lve.el8.x86_64 #1 SMP Tue Dec 3 01:21:19 UTC 2024 x86_64
Server Software:
Apache
PHP Version:
7.4.33
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
opt
/
alt
/
ruby19
/
share
/
ri
/
1.9.1
/
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"DLocks or unlocks a file according to <i>locking_constant</i> (a;TI";logical <em>or</em> of the values in the table below).;TI"@Returns <code>false</code> if <code>File::LOCK_NB</code> is;TI"Bspecified 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 ;FI"< | exclusive lock for a given file at a time. ;FI"A----------+------------------------------------------------ ;FI";LOCK_NB | Don't block when locking. May be combined ;FI"; | with other lock options using logical or. ;FI"A----------+------------------------------------------------ ;FI"ALOCK_SH | Shared lock. Multiple processes may each hold a ;FI"@ | shared lock for a given file at the same time. ;FI"A----------+------------------------------------------------ ;FI"LOCK_UN | Unlock. ;Fo; ; [I" Example:;T@o;; [I")# update a counter using write lock ;FI"@# don't use "w" because it truncates the file before lock. ;FI"=File.open("counter", File::RDWR|File::CREAT, 0644) {|f| ;FI" f.flock(File::LOCK_EX) ;FI" value = f.read.to_i + 1 ;FI" f.rewind ;FI" f.write("#{value}\n") ;FI" f.flush ;FI" f.truncate(f.pos) ;FI"} ;FI" ;FI"(# read the counter using read lock ;FI"$File.open("counter", "r") {|f| ;FI" f.flock(File::LOCK_SH) ;FI" p f.read ;FI"};F: @file0I"2file.flock (locking_constant )-> 0 or false ;T0[ I" (p1);FI"file.c;T