summaryrefslogtreecommitdiff
path: root/misc/netware
diff options
context:
space:
mode:
authorbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-06-26 22:01:02 +0000
committerbnicholes <bnicholes@13f79535-47bb-0310-9956-ffa450edef68>2002-06-26 22:01:02 +0000
commit333ee0ee85c6e648161cc755ffebf1215f640a36 (patch)
tree936b0ef4a887132f5099cc84617b0b06c16f3ffb /misc/netware
parent9b95ce3a0d8308a6d5e2b50f9bb9555fd16c12a1 (diff)
downloadlibapr-333ee0ee85c6e648161cc755ffebf1215f640a36.tar.gz
Removed the ReadWrite mutex that protects the stat cache table. Instead implemented
separate stat cache tables per processor. This eliminates the lock contention that was occuring each time a cache node expired and had to be refreshed. Having a stat cache per processor may cause some data redundancy but ensures that no other thread will be refreshing a node at the same time a thread is reading it. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63523 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'misc/netware')
-rw-r--r--misc/netware/aprlib.def1
-rw-r--r--misc/netware/libprews.c23
2 files changed, 18 insertions, 6 deletions
diff --git a/misc/netware/aprlib.def b/misc/netware/aprlib.def
index 0a2a01eb8..973612427 100644
--- a/misc/netware/aprlib.def
+++ b/misc/netware/aprlib.def
@@ -1,3 +1,4 @@
MODULE LIBC.NLM
MODULE WS2_32.NLM
+IMPORT CpuCurrentProcessor
EXPORT @aprlib.imp
diff --git a/misc/netware/libprews.c b/misc/netware/libprews.c
index fa17427fa..8213636b8 100644
--- a/misc/netware/libprews.c
+++ b/misc/netware/libprews.c
@@ -15,10 +15,12 @@
#include "apr_pools.h"
+#define MAX_PROCESSORS 128
+
typedef struct app_data {
int initialized;
void* gPool;
- void* statCache;
+ void* statCache[MAX_PROCESSORS];
} APP_DATA;
/* library-private data...*/
@@ -174,26 +176,35 @@ void* getGlobalPool()
return NULL;
}
-int setStatCache(void *data)
+int setStatCache(void *data, int proc)
{
APP_DATA *app_data = (APP_DATA*) get_app_data(gLibId);
+ if ((proc < 0) || (proc > (MAX_PROCESSORS-1))) {
+ data = NULL;
+ return 0;
+ }
+
NXLock(gLibLock);
- if (app_data && !app_data->statCache) {
- app_data->statCache = data;
+ if (app_data && !app_data->statCache[proc]) {
+ app_data->statCache[proc] = data;
}
NXUnlock(gLibLock);
return 1;
}
-void* getStatCache()
+void* getStatCache(int proc)
{
APP_DATA *app_data = (APP_DATA*) get_app_data(gLibId);
+ if ((proc < 0) || (proc > (MAX_PROCESSORS-1))) {
+ return NULL;
+ }
+
if (app_data) {
- return app_data->statCache;
+ return app_data->statCache[proc];
}
return NULL;