Ejemplo n.º 1
0
    void RemoveThreadData(image_key_t iid, thread_key_t tid){
        uint32_t h = HashThread(tid);

        assert(threaddata.count(iid) == 1);
        assert(datamap.count(iid) == 1);
        assert(datamap[iid].count(tid) == 1);

        ThreadData* td = threaddata[iid];

        uint32_t actual = h;
        while (td[actual].id != tid){
            actual = (actual + 1) % (ThreadHashMod + 1);
        }
        td[actual].id = 0;
        td[actual].data = 0;
    }
Ejemplo n.º 2
0
bool SQLiteMgr::sessionConfigurate(const DataMap &data)
{
    QSqlQuery query;
    if( ! data.isEmpty() )
    {
        QString query_string;
        for (auto i = 0; i < data.count(); i++) /// \warning TODO: БЫЛО <= ПРОВЕРИТЬ
        {
            query_string += "PRAGMA" + data.keys().at(i) + " = " + data.values().at(i) + " \n";
        }

        return query.exec(query_string);
    }
    return false;
}
Ejemplo n.º 3
0
    uint64_t SetThreadData(image_key_t iid, thread_key_t tid, uint32_t typ){
        uint32_t h = HashThread(tid);

        assert(threaddata.count(iid) == 1);
        assert(datamap.count(iid) == 1);
        assert(datamap[iid].count(tid) == 1);

        ThreadData* td = threaddata[iid];

        uint32_t actual = h;
        
        while (td[actual].id != 0){
            actual = (actual + 1) % (ThreadHashMod + 1);
        }
        T d = datamap[iid][tid];
        td[actual].id = (uint64_t)tid;
        td[actual].data = (uint64_t)dataref(d);

        if (typ == ImageType){
            inform << "Image " << hex << iid << " thread " << tid;
        } else {
            inform << "Thread " << hex << tid << " image " << iid;
        }
        cout
            << " setting up thread data at index "
            << dec << actual << TAB << (uint64_t)td
            << " -> " << hex << td[actual].data
            << endl;

        // just fail if there was a collision. it makes writing tools much easier so we see how well this works for now
        if (actual != h){
            warn << "Collision placing thread-specific data: slot " << dec << h << " already taken" << ENDL;
        }
        assert(actual == h);
        return td[actual].data;
    }