Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/fsdb/file-lock.rb
Overview
Extensions to the File class for non-blocking file locking, and for recording a Format in the File object.
Constant Summary collapse
- CAN_DELETE_OPEN_FILE =
!FSDB::PLATFORM_IS_WINDOWS
- CAN_OPEN_DIR =
!FSDB::PLATFORM_IS_WINDOWS
- LOCK_BLOCK_FIXED_VER =
Hurray!
"1.8.2"- LOCK_DOESNT_BLOCK =
[RUBY_VERSION, LOCK_BLOCK_FIXED_VER]. map {|s| s.split('.')}.sort[0].join('.') == LOCK_BLOCK_FIXED_VER
Instance Attribute Summary collapse
-
#format ⇒ Object
Returns the value of attribute format.
Instance Method Summary collapse
- #fcntl_lock ⇒ Object
-
#lock_exclusive(lock_type) ⇒ Object
Get an exclusive (i.e., write) lock on the file.
-
#lock_shared(lock_type) ⇒ Object
Get a shared (i.e., read) lock on the file.
Instance Attribute Details
#format ⇒ Object
Returns the value of attribute format.
5 6 7 |
# File 'lib/fsdb/file-lock.rb', line 5 def format @format end |
Instance Method Details
#fcntl_lock ⇒ Object
64 65 66 |
# File 'ext/fsdb/fcntl-lock.c', line 64 static VALUE rb_file_fcntl_lock (obj, operation) VALUE obj; |
#lock_exclusive(lock_type) ⇒ Object
Get an exclusive (i.e., write) lock on the file. If the lock is not available, wait for it without blocking other ruby threads.
17 18 |
# File 'lib/fsdb/file-lock.rb', line 17 def lock_exclusive lock_type # :nodoc end |
#lock_shared(lock_type) ⇒ Object
Get a shared (i.e., read) lock on the file. If the lock is not available, wait for it without blocking other ruby threads.
20 21 |
# File 'lib/fsdb/file-lock.rb', line 20 def lock_shared lock_type # :nodoc end |