mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rdoc update.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22605 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8428347e99
commit
4b265d3e7b
1 changed files with 13 additions and 1 deletions
14
file.c
14
file.c
|
@ -3499,7 +3499,19 @@ rb_thread_flock(void *data)
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
*
|
*
|
||||||
* File.new("testfile").flock(File::LOCK_UN) #=> 0
|
* # write lock
|
||||||
|
* # don't use "w" because it truncates the file before lock.
|
||||||
|
* File.open("testfile", File::WRONLY|File::CREAT, 0644) {|f|
|
||||||
|
* f.flock(File::LOCK_EX)
|
||||||
|
* f.truncate(0)
|
||||||
|
* f.write "new content"
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* # read lock
|
||||||
|
* File.open("testfile", "r") {|f|
|
||||||
|
* f.flock(File::LOCK_SH)
|
||||||
|
* p f.read
|
||||||
|
* }
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue