apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wr...@apache.org
Subject cvs commit: apr/locks/win32 locks.c
Date Tue, 27 Nov 2001 04:43:43 GMT
wrowe       01/11/26 20:43:43

  Modified:    locks/win32 locks.c
  Log:
    Fix locks for win32 terminal services, submitted by Mladen Turk
    <mturk@mappingsoft.com>.  This is the cleaner of the two parts of his
    patch, which does _not_ change the initial locking state of the mutex,
    nor add a private owner flag.  Those changes were invalid because no
    part of apr should rely on intimate knowledge of the internals of other
    parts of apr, whenever we can avoid it.
  
  Revision  Changes    Path
  1.46      +16 -2     apr/locks/win32/locks.c
  
  Index: locks.c
  ===================================================================
  RCS file: /home/cvs/apr/locks/win32/locks.c,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- locks.c	2001/07/19 00:11:57	1.45
  +++ locks.c	2001/11/27 04:43:43	1.46
  @@ -100,7 +100,6 @@
       /* ToDo:  How to handle the case when no pool is available? 
       *         How to cleanup the storage properly?
       */
  -    newlock->fname = apr_pstrdup(pool, fname);
       newlock->type = type;
       newlock->scope = scope;
       sec.nLength = sizeof(SECURITY_ATTRIBUTES);
  @@ -114,9 +113,24 @@
       }
   
       if (scope == APR_INTRAPROCESS) {
  +        newlock->fname = apr_pstrdup(pool, fname);
           InitializeCriticalSection(&newlock->section);
       } else {
  -        newlock->mutex = CreateMutex(&sec, FALSE, fname);
  +        /* With Win2000 Terminal Services, the Mutex name can have a 
  +         * "Global\" or "Local\" prefix to explicitly create the object 
  +         * in the global or session name space.  Without Terminal Service
  +         * running on Win2000, Global\ and Local\ are ignored.  These
  +         * prefixes are only valid on Win2000+
  +         */
  +        if (apr_os_level >= APR_WIN_2000)
  +            newlock->fname = apr_pstrcat(pool, "Global\\", fname, NULL);
  +        else
  +            newlock->fname = apr_pstrdup(pool, fname);
  +
  +        newlock->mutex = CreateMutex(&sec, FALSE, newlock->fname);
  +        if (!newlock->mutex) {
  +	    return apr_get_os_error();
  +        }
       }
       *lock = newlock;
       apr_pool_cleanup_register(newlock->pool, newlock, lock_cleanup,
  
  
  

Mime
View raw message