You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@locus.apache.org on 2000/03/02 23:35:52 UTC
cvs commit: apache-2.0/src/lib/apr/locks/unix locks.c
manoj 00/03/02 14:35:51
Modified: src/lib/apr/locks/unix locks.c
Log:
Don't open a lock file unless we actually need it.
Submitted by: Jeff Trawick <tr...@ibm.net>
Revision Changes Path
1.18 +12 -7 apache-2.0/src/lib/apr/locks/unix/locks.c
Index: locks.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- locks.c 2000/01/25 23:04:27 1.17
+++ locks.c 2000/03/02 22:35:51 1.18
@@ -71,7 +71,7 @@
* determine if it should be used.
* arg 4) The newly created lock structure.
* NOTE: APR_CROSS_PROCESS may lock both processes and threads, but it is
- * only garaunteed to lock processes.
+ * only guaranteed to lock processes.
*/
ap_status_t ap_create_lock(struct lock_t **lock, ap_locktype_e type,
ap_lockscope_e scope, char *fname,
@@ -84,13 +84,18 @@
new->cntxt = cont;
new->type = type;
- if (fname != NULL) {
- new->fname = ap_pstrdup(cont, fname);
+#if defined(USE_FCNTL_SERIALIZE) || defined(USE_FLOCK_SERIALIZE)
+ /* file-based serialization primitives */
+ if (type != APR_INTRAPROCESS) {
+ if (fname != NULL) {
+ new->fname = ap_pstrdup(cont, fname);
+ }
+ else {
+ new->fname = ap_pstrdup(cont, tempnam(NULL, NULL));
+ unlink(new->fname);
+ }
}
- else {
- new->fname = ap_pstrdup(cont, tempnam(NULL, NULL));
- unlink(new->fname);
- }
+#endif
if (type != APR_CROSS_PROCESS) {
#if APR_HAS_THREADS