void hs_spt_insert_stableptr(StgWord64 key[2], StgStablePtr *entry) { // hs_spt_insert is called from constructor functions, so // the SPT needs to be initialized here. if (spt == NULL) { spt = allocHashTable_(hashFingerprint, compareFingerprint); #if defined(THREADED_RTS) initMutex(&spt_lock); #endif } ACQUIRE_LOCK(&spt_lock); insertHashTable(spt, (StgWord)key, entry); RELEASE_LOCK(&spt_lock); }
void hs_spt_insert(StgWord64 key[2],void *spe_closure) { // hs_spt_insert is called from constructor functions, so // the SPT needs to be initialized here. if (spt == NULL) { spt = allocHashTable_( (HashFunction *)hashFingerprint , (CompareFunction *)compareFingerprint ); #ifdef THREADED_RTS initMutex(&spt_lock); #endif } StgStablePtr * entry = stgMallocBytes( sizeof(StgStablePtr) , "hs_spt_insert: entry" ); *entry = getStablePtr(spe_closure); ACQUIRE_LOCK(&spt_lock); insertHashTable(spt, (StgWord)key, entry); RELEASE_LOCK(&spt_lock); }
void initFileLocking(void) { obj_hash = allocHashTable_(hashLock, cmpLocks); fd_hash = allocHashTable(); /* ordinary word-based table */ }