------- Context.c ------- --- /tmp/geta26303 Sat Jun 18 18:15:09 2005 +++ /tmp/getb26303 Sat Jun 18 18:15:09 2005 @@ -198,10 +198,11 @@ if (!db->table) { Xfree((char *)db); return XCNOMEM; } db->numentries = 0; + db->linfo.lock = (xmutex_t) NULL; _XCreateMutex(&db->linfo); #ifdef MOTIFBC if (!display) *pdb = db; else #endif { @@ -209,10 +210,12 @@ *pdb = db; display->free_funcs->context_db = _XFreeContextDB; UnlockDisplay(display); } } + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); head = &Hash(db, rid, context); _XUnlockMutex(&db->linfo); for (entry = *head; entry; entry = entry->next) { if (entry->rid == rid && entry->context == context) { @@ -260,10 +263,12 @@ db = display->context_db; UnlockDisplay(display); } if (!db) return XCNOENT; + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); for (entry = Hash(db, rid, context); entry; entry = entry->next) { if (entry->rid == rid && entry->context == context) { *data = (XPointer)entry->data; @@ -298,10 +303,12 @@ db = display->context_db; UnlockDisplay(display); } if (!db) return XCNOENT; + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); for (prev = &Hash(db, rid, context); entry = *prev; prev = &entry->next) { if (entry->rid == rid && entry->context == context) { ------- Xrm.c ------- --- /tmp/geta26303 Sat Jun 18 18:15:09 2005 +++ /tmp/getb26303 Sat Jun 18 18:15:09 2005 @@ -482,10 +482,11 @@ { register XrmDatabase db; db = (XrmDatabase) Xmalloc(sizeof(XrmHashBucketRec)); if (db) { + db->linfo.lock = (xmutex_t) NULL; _XCreateMutex(&db->linfo); db->table = (NTable)NULL; db->methods = _XrmInitParseInfo(&db->mbstate); if (!db->methods) db->methods = (XrmMethods)&mb_methods; @@ -752,11 +753,15 @@ register NTable ftable, ttable, nftable; if (!*into) { *into = from; } else if (from) { + if (!(&from->linfo.lock)) + _XCreateMutex(&from->linfo); _XLockMutex(&from->linfo); + if (!(&(*into)->linfo.lock)) + _XCreateMutex(&(*into)->linfo); _XLockMutex(&(*into)->linfo); if (ftable = from->table) { prev = &(*into)->table; ttable = *prev; if (!ftable->leaf) { @@ -994,10 +999,12 @@ XrmQuarkList quarks; XrmRepresentation type; XrmValuePtr value; { if (!*pdb) *pdb = NewDatabase(); + if (!(*pdb)->linfo.lock) + _XCreateMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, type, value); _XUnlockMutex(&(*pdb)->linfo); } @@ -1017,10 +1024,12 @@ { XrmBinding bindings[MAXDBDEPTH+1]; XrmQuark quarks[MAXDBDEPTH+1]; if (!*pdb) *pdb = NewDatabase(); + if (!(*pdb)->linfo.lock) + _XCreateMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo); XrmStringToBindingQuarkList(specifier, bindings, quarks); PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); _XUnlockMutex(&(*pdb)->linfo); } @@ -1042,10 +1051,12 @@ XrmValue value; if (!*pdb) *pdb = NewDatabase(); value.addr = (XPointer) str; value.size = strlen(str)+1; + if (!(*pdb)->linfo.lock) + _XCreateMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, XrmQString, &value); _XUnlockMutex(&(*pdb)->linfo); } @@ -1482,10 +1493,12 @@ if (!*pdb) *pdb = NewDatabase(); XrmStringToBindingQuarkList(specifier, bindings, quarks); value.addr = (XPointer) str; value.size = strlen(str)+1; + if (!(*pdb)->linfo.lock) + _XCreateMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo); PutEntry(*pdb, bindings, quarks, XrmQString, &value); _XUnlockMutex(&(*pdb)->linfo); } @@ -1499,10 +1512,12 @@ XrmDatabase *pdb; char *line; #endif { if (!*pdb) *pdb = NewDatabase(); + if (!(*pdb)->linfo.lock) + _XCreateMutex(&(*pdb)->linfo); _XLockMutex(&(*pdb)->linfo); GetDatabase(*pdb, line, (char *)NULL, False); _XUnlockMutex(&(*pdb)->linfo); } @@ -1515,10 +1530,12 @@ #endif { XrmDatabase db; db = NewDatabase(); + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); GetDatabase(db, data, (char *)NULL, True); _XUnlockMutex(&db->linfo); return db; } @@ -1601,10 +1618,12 @@ if (!(str = ReadInFile(filename))) return (XrmDatabase)NULL; db = NewDatabase(); + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); GetDatabase(db, str, filename, True); _XUnlockMutex(&db->linfo); Xfree(str); return db; @@ -1631,10 +1650,12 @@ db = *target; if (!db) *target = db = NewDatabase(); } else db = NewDatabase(); + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); GetDatabase(db, str, filename, True); _XUnlockMutex(&db->linfo); Xfree(str); if (!override) @@ -1898,10 +1919,12 @@ EClosureRec eclosure; Bool retval = False; if (!db) return False; + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); eclosure.db = db; eclosure.proc = proc; eclosure.closure = closure; eclosure.bindings = bindings; @@ -2195,10 +2218,12 @@ return False; closure.list = (LTable *)searchList; closure.idx = -1; closure.limit = listLength - 2; if (db) { + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); table = db->table; if (*names) { if (table && !table->leaf) { if (SearchNEntry(table, names, classes, &closure)) { @@ -2469,10 +2494,12 @@ { register NTable table; VClosureRec closure; if (db && *names) { + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); closure.type = pType; closure.value = pValue; table = db->table; if (names[1]) { @@ -2572,10 +2599,12 @@ char *XrmLocaleOfDatabase(db) XrmDatabase db; { char* retval; + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); retval = (*db->methods->lcname)(db->mbstate); _XUnlockMutex(&db->linfo); return retval; } @@ -2584,10 +2613,12 @@ XrmDatabase db; { register NTable table, next; if (db) { + if (!db->linfo.lock) + _XCreateMutex(&db->linfo); _XLockMutex(&db->linfo); for (next = db->table; table = next; ) { next = table->next; if (table->leaf) DestroyLTable((LTable)table);