[前][次][番号順一覧][スレッド一覧]

ruby-changes:11015

From: akr <ko1@a...>
Date: Wed, 25 Feb 2009 02:07:44 +0900 (JST)
Subject: [ruby-changes:11015] Ruby:r22605 (trunk): rdoc update.

akr	2009-02-25 02:07:38 +0900 (Wed, 25 Feb 2009)

  New Revision: 22605

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22605

  Log:
    rdoc update.

  Modified files:
    trunk/file.c

Index: file.c
===================================================================
--- file.c	(revision 22604)
+++ file.c	(revision 22605)
@@ -3499,8 +3499,20 @@
  *
  *  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
+ *     }
+ *
  */
 
 static VALUE

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]