コード例 #1
0
void AsyncTQueueType::put(uint64_t time, IFace *cb) {
    RISCV_mutex_lock(&mutex_);
    item_[Queue_Time].make_uint64(time);
    item_[Queue_IFace].make_iface(cb);
    if (preLen_ == stepPreQueued_.size()) {
        unsigned new_sz = 2 * stepPreQueued_.size();
        if (new_sz == 0) {
            new_sz = 1;
        }
        stepPreQueued_.realloc_list(new_sz);
    }
    stepPreQueued_[preLen_].attr_free();
    stepPreQueued_[preLen_] = item_;
    preLen_++;
    RISCV_mutex_unlock(&mutex_);
}
コード例 #2
0
void AsyncTQueueType::pushPreQueued() {
    if (preLen_ == 0) {
        return;
    }
    RISCV_mutex_lock(&mutex_);
    for (unsigned i = 0; i < preLen_; i++) {
        if (curLen_ < stepQueue_.size()) {
            stepQueue_[curLen_].attr_free();
            stepQueue_[curLen_] = stepPreQueued_[i];
        } else {
            stepQueue_.add_to_list(&stepPreQueued_[i]);
        }
        curLen_++;
    }
    preLen_= 0;
    RISCV_mutex_unlock(&mutex_);
}
コード例 #3
0
ファイル: api_core.cpp プロジェクト: jrrk2/greth_library
extern "C" void RISCV_cleanup() {
    IClass *icls;
    IService *iserv;
    const AttributeType *objs;

    // Pre-deletion
    for (unsigned i = 0; i < listClasses_.size(); i++) {
        icls = static_cast<IClass *>(listClasses_[i].to_iface());
        objs = (icls->getInstanceList());
        for (unsigned n = 0; n < objs->size(); n++) {
            iserv = static_cast<IService *>((*objs)[n].to_iface());
            icls->predeleteServices(iserv);
        }
    }

#if defined(_WIN32) || defined(__CYGWIN__)
    WSACleanup();
#endif

    _unload_plugins(&listPlugins_);
    RISCV_mutex_lock(&mutex_printf);
    RISCV_mutex_destroy(&mutex_printf);
}