41 bool AddItem(
void *newdata,
void *olddata,
const char *key,
42 int hash,
bool replace=
false);
44 bool Attach(
int tout,
bool isrw=
false);
50 bool DelItem(
void *data,
const char *key,
int hash);
54 bool Enumerate(
void *&jar,
char *&key,
void *&val);
58 bool GetItem(
void *data,
const char *key,
int hash);
60 int Info(
const char *vname,
char *buff=0,
int blen=0);
65 bool Sync(
bool dosync,
bool syncdo);
66 bool Sync(
int syncqsz);
71 pthread_mutex_destroy(&lkMutex);
72 pthread_rwlock_destroy(&myMutex);
78 struct MemItem {
int hash;
Atomic(
int) next;};
80 bool ExportIt(
bool fLocked);
81 int Find(MemItem *&theItem, MemItem *&prvItem,
const char *key,
int &hash);
83 int HashVal(
const char *key);
84 bool Lock(
bool doRW=
false,
bool nowait=
false);
87 void RetItem(MemItem *iP);
88 void SetLocking(
bool isrw);
91 void UnLock(
bool isrw);
92 void Updated(
int mOff);
93 void Updated(
int mOff,
int mLen);
98 inline bool FLock() {
if (!(shmemP->Lock(lkType)))
return false;
99 doUnLock =
true;
return true;
103 : shmemP(shmemp), lkType(lktype), doUnLock(false)
105 pthread_rwlock_wrlock(&(shmemP->myMutex));
106 else pthread_rwlock_rdlock(&(shmemP->myMutex));
108 ~XLockHelper() {
int rc = errno;
109 if (lkType ==
RWLock && shmemP->syncOn
110 && shmemP->syncQWR > shmemP->syncQSZ)
112 if (doUnLock) shmemP->UnLock(lkType ==
RWLock);
113 pthread_rwlock_unlock(&(shmemP->myMutex));
122 pthread_mutex_t lkMutex;
123 pthread_rwlock_t myMutex;
128 Atomic(
int)*shmIndex;
XrdSsiShMam(XrdSsiShMat::NewParms &parms)
bool Resize(XrdSsiShMat::CRZParms &parms)
bool Create(XrdSsiShMat::CRZParms &parms)
void Detach()
Detach the map from the shared memory.
bool AddItem(void *newdata, void *olddata, const char *key, int hash, bool replace=false)
bool DelItem(void *data, const char *key, int hash)
int Info(const char *vname, char *buff=0, int blen=0)
bool GetItem(void *data, const char *key, int hash)
bool Attach(int tout, bool isrw=false)
bool Enumerate(void *&jar, char *&key, void *&val)