rbb         99/09/20 14:33:11

  Modified:    src/lib/apr/include apr_lock.h
               src/lib/apr/locks/unix locks.c
               src/lib/apr/test testthread.c
  Log:
  Allow APR locks to do more than just straight mutex.  Only mutex is
  implemented, but at least now we can add different kinds of locks later.
  
  Revision  Changes    Path
  1.3       +5 -2      apache-2.0/src/lib/apr/include/apr_lock.h
  
  Index: apr_lock.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lock.h,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- apr_lock.h        1999/09/14 13:37:21     1.2
  +++ apr_lock.h        1999/09/20 21:33:05     1.3
  @@ -63,12 +63,15 @@
   extern "C" {
   #endif /* __cplusplus */
   
  -typedef enum {APR_CROSS_PROCESS, APR_INTRAPROCESS, APR_LOCKALL} 
ap_locktype_e;
  +typedef enum {APR_CROSS_PROCESS, APR_INTRAPROCESS, APR_LOCKALL} 
ap_lockscope_e;
   
  +typedef enum {APR_MUTEX, APR_READWRITE} ap_locktype_e;
  +
   typedef struct lock_t           ap_lock_t;
   
   /*   Function definitions */
  -ap_status_t ap_create_lock(ap_context_t *, ap_locktype_e, char *, ap_lock_t 
**);
  +ap_status_t ap_create_lock(ap_context_t *, ap_locktype_e, ap_lockscope_e, 
  +                           char *, ap_lock_t **);
   ap_status_t ap_lock(ap_lock_t *);
   ap_status_t ap_unlock(ap_lock_t *);
   ap_status_t ap_destroy_lock(ap_lock_t *);
  
  
  
  1.4       +7 -2      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- locks.c   1999/09/14 13:37:23     1.3
  +++ locks.c   1999/09/20 21:33:07     1.4
  @@ -76,7 +76,9 @@
    * NOTE:  APR_CROSS_PROCESS may lock both processes and threads, but it is
    *        only garaunteed to lock processes.
    */
  -ap_status_t ap_create_lock(ap_context_t *cont, ap_locktype_e type, char 
*fname, struct lock_t **lock)
  +ap_status_t ap_create_lock(ap_context_t *cont, ap_locktype_e type, 
  +                           ap_lockscope_e scope, char *fname, 
  +                           struct lock_t **lock)
   {
       struct lock_t *new;
       ap_status_t stat;
  @@ -196,7 +198,8 @@
    * ap_status_t ap_get_lockdata(ap_lock_t *, char *key, void *)
    *    Return the context associated with the current lock.
    * arg 1) The currently open lock.
  - * arg 2) The user data associated with the lock.
  + * arg 2) The key to use when retreiving data associated with this lock
  + * arg 3) The user data associated with the lock.
    */
   ap_status_t ap_get_lockdata(struct lock_t *lock, char *key, void *data)
   {
  @@ -215,6 +218,8 @@
    *    Return the context associated with the current lock.
    * arg 1) The currently open lock.
    * arg 2) The user data to associate with the lock.
  + * arg 3) The key to use when associating data with this lock
  + * arg 4) The cleanup to use when the lock is destroyed.
    */
   ap_status_t ap_set_lockdata(struct lock_t *lock, void *data, char *key,
                               ap_status_t (*cleanup) (void *))
  
  
  
  1.3       +1 -1      apache-2.0/src/lib/apr/test/testthread.c
  
  Index: testthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testthread.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- testthread.c      1999/09/14 13:37:27     1.2
  +++ testthread.c      1999/09/20 21:33:09     1.3
  @@ -136,7 +136,7 @@
       fprintf(stdout, "OK\n");
   
       fprintf(stdout, "Initializing the lock......."); 
  -    s1 = ap_create_lock(context, APR_INTRAPROCESS, "lock.file", 
&thread_lock); 
  +    s1 = ap_create_lock(context, APR_MUTEX, APR_INTRAPROCESS, "lock.file", 
&thread_lock); 
       if (s1 != APR_SUCCESS) {
           fprintf(stderr, "Could not create lock\n");
           exit(-1);
  
  
  

Reply via email to