summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2001-06-06 18:12:14 +0000
committerdreid <dreid@13f79535-47bb-0310-9956-ffa450edef68>2001-06-06 18:12:14 +0000
commit9f3367b7da2bb70408c321d700620a759f686fcd (patch)
tree58a922c7192529dab2de7339fbfdf6587aacfb1c /include
parentb1d00253b172a30216646eb78e7946d82b95668f (diff)
downloadlibapr-9f3367b7da2bb70408c321d700620a759f686fcd.tar.gz
This is a much larger commit than I meant to have, but a lot has
been changed in my tree today :) - remove the sms code I committed yesterday - add an apr_pool_t to the sms structure - add locking code to the tracking sms This threw up an issue with locking, so next - change the locking code to add an owner and ref counting so we can lock multiple times from the same thread. this was needed by the apr_sms_tracking_reset code where we lock and then call free which locks again... I haven't added the locking changes for os2 or win32 after the problems I created with my last commit :) Changes to testlock on the way. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@61716 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r--include/apr.h.in3
-rw-r--r--include/apr_lock.h3
-rw-r--r--include/apr_portable.h2
-rw-r--r--include/apr_sms.h45
-rw-r--r--include/apr_thread_proc.h1
-rw-r--r--include/arch/beos/locks.h8
-rw-r--r--include/arch/os2/locks.h6
-rw-r--r--include/arch/unix/locks.h11
-rw-r--r--include/arch/win32/locks.h6
9 files changed, 38 insertions, 47 deletions
diff --git a/include/apr.h.in b/include/apr.h.in
index c72981e43..0ce684ad1 100644
--- a/include/apr.h.in
+++ b/include/apr.h.in
@@ -174,9 +174,6 @@ typedef @ssize_t_value@ apr_ssize_t;
typedef @off_t_value@ apr_off_t;
typedef @socklen_t_value@ apr_socklen_t;
-typedef struct apr_lock_t apr_lock_t;
-typedef struct apr_sms_t apr_sms_t;
-
/* Mechanisms to properly type numeric literals */
@int64_literal@
diff --git a/include/apr_lock.h b/include/apr_lock.h
index 0f495cec2..b3f0dff87 100644
--- a/include/apr_lock.h
+++ b/include/apr_lock.h
@@ -58,7 +58,6 @@
#include "apr.h"
#include "apr_pools.h"
#include "apr_errno.h"
-#include "apr_sms.h"
#ifdef __cplusplus
extern "C" {
@@ -74,6 +73,8 @@ typedef enum {APR_MUTEX, APR_READWRITE} apr_locktype_e;
typedef enum {APR_READER, APR_WRITER} apr_readerwriter_e;
+typedef struct apr_lock_t apr_lock_t;
+
/* Function definitions */
/**
diff --git a/include/apr_portable.h b/include/apr_portable.h
index 26c4bec7d..b0b2b84a2 100644
--- a/include/apr_portable.h
+++ b/include/apr_portable.h
@@ -418,6 +418,8 @@ APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso,
APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso,
apr_dso_handle_t *aprdso);
+APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void);
+
#endif /* APR_HAS_DSO */
#ifdef __cplusplus
diff --git a/include/apr_sms.h b/include/apr_sms.h
index 7f93ed98d..64e9abc56 100644
--- a/include/apr_sms.h
+++ b/include/apr_sms.h
@@ -65,6 +65,8 @@
#include "apr.h"
#include "apr_errno.h"
+#include "apr_pools.h"
+#include "apr_lock.h"
#ifdef __cplusplus
extern "C" {
@@ -80,32 +82,35 @@ extern "C" {
*/
struct apr_sms_cleanup;
+typedef struct apr_sms_t apr_sms_t;
/**
* The memory system structure
*/
struct apr_sms_t
{
- apr_sms_t *parent_mem_sys;
- apr_sms_t *child_mem_sys;
- apr_sms_t *sibling_mem_sys;
- apr_sms_t **ref_mem_sys;
- apr_sms_t *accounting_mem_sys;
- const char *identity; /* a string identifying the module */
- apr_lock_t *lock;
-
- struct apr_sms_cleanup *cleanups;
-
- void * (*malloc_fn) (apr_sms_t *mem_sys, apr_size_t size);
- void * (*calloc_fn) (apr_sms_t *mem_sys, apr_size_t size);
- void * (*realloc_fn) (apr_sms_t *mem_sys, void *memory,
- apr_size_t size);
- apr_status_t (*free_fn) (apr_sms_t *mem_sys, void *memory);
- apr_status_t (*reset_fn) (apr_sms_t *mem_sys);
- void (*pre_destroy_fn) (apr_sms_t *mem_sys);
- apr_status_t (*destroy_fn)(apr_sms_t *mem_sys);
- apr_status_t (*lock_fn) (apr_sms_t *mem_sys);
- apr_status_t (*unlock_fn) (apr_sms_t *mem_sys);
+ apr_sms_t *parent_mem_sys;
+ apr_sms_t *child_mem_sys;
+ apr_sms_t *sibling_mem_sys;
+ apr_sms_t **ref_mem_sys;
+ apr_sms_t *accounting_mem_sys;
+ const char *identity; /* a string identifying the module */
+
+ apr_pool_t *pool;
+ apr_lock_t *lock;
+
+ struct apr_sms_cleanup *cleanups;
+
+ void * (*malloc_fn) (apr_sms_t *mem_sys, apr_size_t size);
+ void * (*calloc_fn) (apr_sms_t *mem_sys, apr_size_t size);
+ void * (*realloc_fn) (apr_sms_t *mem_sys, void *memory,
+ apr_size_t size);
+ apr_status_t (*free_fn) (apr_sms_t *mem_sys, void *memory);
+ apr_status_t (*reset_fn) (apr_sms_t *mem_sys);
+ void (*pre_destroy_fn) (apr_sms_t *mem_sys);
+ apr_status_t (*destroy_fn)(apr_sms_t *mem_sys);
+ apr_status_t (*lock_fn) (apr_sms_t *mem_sys);
+ apr_status_t (*unlock_fn) (apr_sms_t *mem_sys);
};
/*
diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h
index cb3f5ef4c..8fa692c98 100644
--- a/include/apr_thread_proc.h
+++ b/include/apr_thread_proc.h
@@ -65,6 +65,7 @@
#include <sys/resource.h>
#endif
+
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
diff --git a/include/arch/beos/locks.h b/include/arch/beos/locks.h
index 39f48e319..1b3011688 100644
--- a/include/arch/beos/locks.h
+++ b/include/arch/beos/locks.h
@@ -60,13 +60,13 @@
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_lib.h"
-#include "apr_sms.h"
struct apr_lock_t {
apr_pool_t *pool;
- apr_sms_t *mem_sys;
apr_locktype_e type;
apr_lockscope_e scope;
+ apr_os_thread_t *owner;
+ int owner_ref;
/* Inter proc */
sem_id sem_interproc;
int32 ben_interproc;
@@ -88,9 +88,5 @@ apr_status_t destroy_inter_lock(struct apr_lock_t *lock);
apr_status_t child_init_lock(struct apr_lock_t **lock, apr_pool_t *cont,
const char *fname);
-apr_status_t apr_lock_sms_create(apr_lock_t **lock, apr_locktype_e type,
- apr_lockscope_e scope, const char *fname,
- apr_sms_t *mem_sys);
-
#endif /* LOCKS_H */
diff --git a/include/arch/os2/locks.h b/include/arch/os2/locks.h
index 09e700d00..716dfa2a5 100644
--- a/include/arch/os2/locks.h
+++ b/include/arch/os2/locks.h
@@ -57,11 +57,9 @@
#include "apr_lock.h"
#include "apr_file_io.h"
-#include "apr_sms.h"
struct apr_lock_t {
apr_pool_t *pool;
- apr_sms_t *mem_sys;
apr_locktype_e type;
apr_lockscope_e scope;
char *fname;
@@ -71,9 +69,5 @@ struct apr_lock_t {
TIB *tib;
};
-apr_status_t apr_lock_sms_create(apr_lock_t **lock, apr_locktype_e type,
- apr_lockscope_e scope, const char *fname,
- apr_sms_t *mem_sys);
-
#endif /* LOCKS_H */
diff --git a/include/arch/unix/locks.h b/include/arch/unix/locks.h
index 2a062190c..65fa98456 100644
--- a/include/arch/unix/locks.h
+++ b/include/arch/unix/locks.h
@@ -61,6 +61,7 @@
#include "apr_lib.h"
#include "apr_lock.h"
#include "apr_sms.h"
+#include "apr_portable.h"
/* System headers required by Locks library */
#if APR_HAVE_SYS_TYPES_H
@@ -110,11 +111,11 @@ union semun {
struct apr_lock_t {
apr_pool_t *pool;
- apr_sms_t *mem_sys;
apr_locktype_e type;
apr_lockscope_e scope;
int curr_locked;
char *fname;
+
#if APR_USE_SYSVSEM_SERIALIZE
int interproc;
#elif APR_USE_FCNTL_SERIALIZE
@@ -129,6 +130,10 @@ struct apr_lock_t {
#if APR_HAS_THREADS
/* APR doesn't have threads, no sense in having an thread lock mechanism.
*/
+
+ apr_os_thread_t owner;
+ int owner_ref;
+
#if APR_USE_PTHREAD_SERIALIZE
pthread_mutex_t *intraproc;
#endif
@@ -157,9 +162,5 @@ apr_status_t apr_unix_destroy_inter_lock(struct apr_lock_t *lock);
apr_status_t apr_unix_child_init_lock(struct apr_lock_t **lock,
apr_pool_t *cont, const char *fname);
-apr_status_t apr_lock_sms_create(apr_lock_t **lock, apr_locktype_e type,
- apr_lockscope_e scope, const char *fname,
- apr_sms_t *mem_sys);
-
#endif /* LOCKS_H */
diff --git a/include/arch/win32/locks.h b/include/arch/win32/locks.h
index b3da21a04..4d0562b8c 100644
--- a/include/arch/win32/locks.h
+++ b/include/arch/win32/locks.h
@@ -56,11 +56,9 @@
#define LOCKS_H
#include "apr_lock.h"
-#include "apr_sms.h"
struct apr_lock_t {
apr_pool_t *pool;
- apr_sms_t *mem_sys;
apr_locktype_e type;
apr_lockscope_e scope;
HANDLE mutex;
@@ -68,9 +66,5 @@ struct apr_lock_t {
char *fname;
};
-APR_DECLARE(apr_status_t) apr_lock_sms_create(apr_lock_t **lock, apr_locktype_e type,
- apr_lockscope_e scope, const char *fname,
- apr_sms_t *mem_sys);
-
#endif /* LOCKS_H */