cvs: phpdoc-zh /reference/filesystem/functions flock.xml

From: Date: Sun, 22 Dec 2002 09:17:53 +0000
Subject: cvs: phpdoc-zh /reference/filesystem/functions flock.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-926@lists.php.net to get a copy of this message
lm92 Sun Dec 22 04:17:53 2002 EDT Modified files: /phpdoc-zh/reference/filesystem/functions flock.xml Log: finish Index: phpdoc-zh/reference/filesystem/functions/flock.xml diff -u phpdoc-zh/reference/filesystem/functions/flock.xml:1.1 phpdoc-zh/reference/filesystem/functions/flock.xml:1.2 --- phpdoc-zh/reference/filesystem/functions/flock.xml:1.1 Sun Sep 29 22:56:19 2002 +++ phpdoc-zh/reference/filesystem/functions/flock.xml Sun Dec 22 04:17:53 2002 @@ -1,13 +1,13 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.2 --> <refentry id="function.flock"> <refnamediv> <refname>flock</refname> - <refpurpose>Portable advisory file locking</refpurpose> + <refpurpose>Çá±ãµÄ×ÉѯÎļþËø¶¨</refpurpose> </refnamediv> <refsect1> - <title>Description</title> + <title>ÃèÊö</title> <methodsynopsis> <type>bool</type><methodname>flock</methodname> <methodparam><type>int</type><parameter>fp</parameter></methodparam> @@ -15,85 +15,73 @@ <methodparam choice="opt"><type>int</type><parameter>&amp;wouldblock</parameter></methodparam> </methodsynopsis> <simpara> - PHP supports a portable way of locking complete files in an - advisory way (which means all accessing programs have to use the - same way of locking or it will not work). + PHP Ö§³ÖÒÔÒ»×Éѯ·½Ê½£¨Ò²¾ÍÊÇ˵ËùÓзÃÎʳÌÐò±ØÐëʹÓÃͬÒâ·½Ê½Ëø¶¨, ·ñÔòËü²»»á¹¤×÷£©Ëø¶¨È«²¿ÎļþµÄÒ»ÖÖÇá±ã·½·¨¡£ </simpara> <simpara> - <function>flock</function> operates on <parameter>fp</parameter> - which must be an open file - pointer. <parameter>operation</parameter> is one of the following + <function>flock</function> ²Ù×÷µÄ <parameter>fp</parameter> + ±ØÐëÊÇÒ»¸ö¿ª·ÅµÄÎļþÖ¸Õë¡£ + <parameter>operation</parameter> ¿ÉÒÔÊÇÒÔÏÂÖµÖ®Ò» values: </simpara> <para> <itemizedlist> <listitem> <simpara> - To acquire a shared lock (reader), set - <parameter>operation</parameter> to LOCK_SH (set to 1 prior to - PHP 4.0.1). + ÒªÉè¶¨Ëø×¡µµ°¸¿ÉÒÔÔÊÐí±ðµÄÐг̶Áȡʱ£¬½« + <parameter>operation</parameter> ÉèΪ LOCK_SH £¨PHP 4.0.1 ÒÔǰµÄ°æ±¾ÉèÖÃΪ 1£©¡£ </simpara> </listitem> <listitem> <simpara> - To acquire an exclusive lock (writer), set - <parameter>operation</parameter> to LOCK_EX (set to 2 prior to - PHP 4.0.1). + ÒªÉ趨ֻÓиÃÐг̿ÉÒÔдÈëµµ°¸Ê±£¬½« + <parameter>operation</parameter> ÉèΪ LOCK_EX £¨PHP 4.0.1 ÒÔǰµÄ°æ±¾ÖÐÉèÖÃΪ 2£©¡£ </simpara> </listitem> <listitem> <simpara> - To release a lock (shared or exclusive), set - <parameter>operation</parameter> to LOCK_UN (set to 3 prior to - PHP 4.0.1). + ÒªÉ趨Ϊ¶Áд¾ùËø×¡Ê±£¬½« + <parameter>operation</parameter> ÉèΪ LOCK_UN £¨PHP 4.0.1 ÒÔǰµÄ°æ±¾ÖÐÉèÖÃΪ 3£©¡£ </simpara> </listitem> <listitem> <simpara> - If you don't want <function>flock</function> to block while - locking, add LOCK_NB (4 prior to PHP 4.0.1) to - <parameter>operation</parameter>. + Èç¹ûÄ㲻ϣÍû <function>flock</function> Ëø×¡Çø¿é£¬½« + <parameter>operation</parameter> É趨Ϊ LOCK_NB £¨PHP 4.0.1 ÒÔǰµÄ°æ±¾ÖÐÉèÖÃΪ 4£©¡£ </simpara> </listitem> </itemizedlist> </para> <simpara> - <function>flock</function> allows you to perform a simple - reader/writer model which can be used on virtually every platform - (including most Unix derivatives and even Windows). The optional third - argument is set to &true; if the lock would block (EWOULDBLOCK - errno condition) + <function>flock</function> ÔÊÐíÄãÖ´ÐÐÒ»¸ö¼òµ¥µÄ¿ÉÒÔÔÚÈÎºÎÆ½Ì¨ÖÐʹÓõĶÁÈ¡/дÈëÄ£ÐÍ + £¨°üÀ¨´ó²¿·ÖµÄ Unix ÅÉÉú°æºÍÉõÖÁÊÇ Windows£©¡£ÈçÊÇËø¶¨µÄÊÇÇø¿é£¨EWOULDBLOCK errno condition£© + Ç뽫µÚÈý¸ö²ÎÊýÉèÖÃΪ &true; ¡£ </simpara> <simpara> - <function>flock</function> returns &true; on success and &false; on - error (e.g. when a lock could not be acquired). + <function>flock</function> »áÔÚËø¶¨³É¹¦ºó·µ»Ø &true; £¬Èç¹ûËø¶¨Ê§°ÜÔò·µ»Ø &false; + £¨ÀýÈçÎļþ²»ÄÜËø¶¨£©¡£ </simpara> <note> <para> - Because <function>flock</function> requires a file pointer, you may have - to use a special lock file to protect access to a file that you intend - to truncate by opening it in write mode (with a "w" or "w+" argument to - <function>fopen</function>). + ÓÉÓÚ <function>flock</function> ÐèÒªÒ»¸öÎļþÖ¸Õ룬 Òò´ËÄã¿ÉÄÜ + ÐèÒªÒ»¸öËø¶¨ÎļþÀ´±£»¤Äã×¼±¸ÒÔдģʽ´ò¿ªµÄÎļþ¡£ + £¨ÔÚ <function>fopen</function> º¯ÊýÖмÓÈë "w" »ò "w+"£©¡£ </para> </note> <warning> <para> - <function>flock</function> will not work on NFS and many other networked - file systems. Check your operating system documentation for more - details. + <function>flock</function> ²»ÄÜÔÚNFSÒÔ¼°ÆäËûµÄÒ»Ð©ÍøÂçÎļþϵͳÖÐÕý³£¹¤×÷¡£Ïêϸ×ÊÁÏÇë¼ì²éÄãµÄ²Ù×÷ϵͳÎĵµ¡£ </para> <para> - On some operating systems <function>flock</function> is implemented at - the process level. When using a multithreaded server API like ISAPI you - may not be able to rely on <function>flock</function> to protect files - against other PHP scripts running in parallel threads of the same server + ÔÚ²¿·Ö²Ù×÷ϵͳÖУ¬ <function>flock</function> ÒÔ´¦Àí¼¶Ö´ÐС£ + µ±ÓÃÒ»¸ö¶àÏ̷߳þÎñÆ÷ API£¨±ÈÈç ISAPI£©Ê±£¬ + Äú¿ÉÄܲ»¿ÉÒÔÒÀ¿¿ <function>flock</function> À´±£»¤Îļþ£¬ + ÒòΪÔÚͬһ·þÎñÆ÷ÄÚÔËÐÐÔÚÆäËü³ÌÏßµÄPHP½Å±¾¿ÉÒÔ¶Ô¸ÃÎļþ½øÐд¦Àí¡£ instance! </para> <para> - <function>flock</function> is not supported on antiquated filesystems like - <literal>FAT</literal> and its derivates and will therefore always - return &false; under this environments (this is especially true for - Windows 98 users). + <function>flock</function> ²»Ö§³Ö¾ÉµÄÎļþϵͳ£¬Èç + <literal>FAT</literal> ÒÔ¼°ËüµÄÅÉÉúϵͳ¡£Òò´Ë£¬ËüÔÚÕâÖÖÇé¿öϾ­³£»á·µ»Ø + Ò»¸ö &false; Öµ£¨ÓÈÆäÊÇÖ¸Windows 98µÄÓû§£©¡£ </para> </warning> </refsect1>

« previous php.doc.zh (#926) next »