Unless anyone sees a way to do this without adding the lock, I'd like to
commit this patch.
It adds a php_flock call only for windows. In doing so I got rid of the
win32/flock files and now compile with flock_compat from main.
Rob
Richard Quadling wrote:
The testing I'm using is to launch multiple copies of the same PHP
script simultaneously using php.exe (CLI mode). This could easily be
multiple FastCGI scripts or multiple ISAPI threads.
On 16/04/07, William A. Rowe, Jr. <[EMAIL PROTECTED]> wrote:
Richard Quadling wrote:
> So isn't locking the solution for Windows?
If this is single writer process, even with multithreads - a mutex
is most efficient, otherwise with concurrent writer processes, file
locking makes the most sense.
Bill
Index: ext/standard/config.w32
===================================================================
RCS file: /repository/php-src/ext/standard/config.w32,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 config.w32
--- ext/standard/config.w32 4 Jan 2006 21:31:29 -0000 1.4.2.2
+++ ext/standard/config.w32 17 Apr 2007 11:34:16 -0000
@@ -16,5 +16,5 @@
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c \
- streamsfuncs.c http.c", false /* never shared */);
+ streamsfuncs.c http.c flock_compat.c", false /* never shared */);
Index: main/main.c
===================================================================
RCS file: /repository/php-src/main/main.c,v
retrieving revision 1.640.2.23.2.34
diff -u -r1.640.2.23.2.34 main.c
--- main/main.c 16 Apr 2007 08:09:56 -0000 1.640.2.23.2.34
+++ main/main.c 17 Apr 2007 11:49:49 -0000
@@ -63,6 +63,7 @@
#ifdef PHP_WIN32
#include <io.h>
#include "win32/php_registry.h"
+#include "ext/standard/flock_compat.h"
#endif
#include "php_syslog.h"
#include "Zend/zend_exceptions.h"
@@ -362,8 +363,11 @@
time(&error_time);
strftime(error_time_str, sizeof(error_time_str),
"%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
len = spprintf(&tmp, 0, "[%s] %s%s", error_time_str,
log_message, PHP_EOL);
+#ifdef PHP_WIN32
+ php_flock(fd, 2);
+#endif
write(fd, tmp, len);
- efree(tmp);
+ efree(tmp);
close(fd);
return;
}
Index: win32/build/config.w32
===================================================================
RCS file: /repository/php-src/win32/build/config.w32,v
retrieving revision 1.40.2.8.2.9
diff -u -r1.40.2.8.2.9 config.w32
--- win32/build/config.w32 16 Apr 2007 08:09:56 -0000 1.40.2.8.2.9
+++ win32/build/config.w32 17 Apr 2007 11:39:05 -0000
@@ -309,7 +309,7 @@
ADD_SOURCES("main/streams", "streams.c cast.c memory.c filter.c
plain_wrapper.c \
userspace.c transports.c xp_socket.c mmap.c");
-ADD_SOURCES("win32", "crypt_win32.c flock.c glob.c md5crypt.c readdir.c \
+ADD_SOURCES("win32", "crypt_win32.c glob.c md5crypt.c readdir.c \
registry.c select.c sendmail.c time.c wfile.c winutil.c wsyslog.c
globals.c");
ADD_SOURCES("regex", "regcomp.c regerror.c regexec.c regfree.c");
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php