Windows 㧠flock ã® LOCK_EX + LOCK_NB ã®ãããªæãã§ãã¡ã¤ã«ããã¯ãã
"windows LOCK_NB" ã¨ãã§ãããã¨ç¡éã« PHP ã®æ
å ±ãããããã¦ãªããªãææã®æ
å ±ã«è¾¿ãã¤ããªãã£ãã®ã ããã©ï¼ã©ããã LockFileEx ã使ãã°è¯ããããï¼
LockFileEx function (Windows)
LOCKFILE_EXCLUSIVE_LOCK (0x00000002) ã dwFlags ã«æå®ãã¦ããã¨ãã¡ã¤ã«ãæä»ããã¯ãããã¨ãã§ã (æå®ããªãå ´åã¯å
±æããã¯)ï¼LOCKFILE_FAIL_IMMEDIATELY (0x00000001) ãæå®ããã¨ããã¯ãåå¾ã§ããªãã£ããå³åº§ã«å¤±æãè¿ãã¦ããããã«ãªã (æå®ããªãå ´åã¯ããã¯ãå¾ãããã¾ã§å¾
ã¤)ï¼ã¤ã¾ãï¼ããã㯠flock ã® LOCK_EX 㨠LOCK_NB ã«å¯¾å¿ãã¦ããã¨è¨ããï¼
ã¤ã¾ãï¼ä»¥ä¸ã®ããã«ä½¿ã㨠flock ã® LOCK_EX | LOCK_NB ç¸å½ã®äºãã§ãã (ã³ã¼ãã¯ããããæã£ã¦ãã:
Locking and Unlocking Byte Ranges in Files (Windows))ï¼
fSuccess = LockFileEx(hFile, // exclusive access, LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY, 0, // reserved, must be zero TESTSTRLEN, // number of bytes to lock 0, &sOverlapped); // contains the file offset
便å©ä¾¿å©ï¼