zoukankan      html  css  js  c++  java
  • CCHttpRequest不能做队列加载?

    之前做的PreLoader由于继承自CCOBject,加载一个文件后就让CCHttpRequest->release(),这时发现Preloader的析构函数会被调用,说明Prelaoder正常释放了,可以如果用这个CCHttpReqeust的一个 实例来做队列加载,不管是每次队列循环时release(),还是在最后一次加载release(),Prelaodre 就是不能被释放,虽然资源时都加载好了。

    原因没有找到,临时处理办法就是每次的队列循环都new一个CCHttpReqeust的实力,每次CCHttpCLient send()之后就把这个request实力releast()掉就ok了。(CCHttpClient内部采用了pthread + curl,多线程异步加载)

        CCHttpRequest *loopRequest = new CCHttpRequest();
        loopRequest->setRequestType(CCHttpRequest::kHttpGet);
        loopRequest->setResponseCallback(this, callfuncND_selector(Preloader::queueLoadCallback));
        loopRequest->setTag(currentItem->path.c_str());
        loopRequest->setUrl(currentItem->path.c_str());
        CCHttpClient::getInstance()->send(loopRequest);
        loopRequest->release();
  • 相关阅读:
    js对象
    _proto_和prototype区别
    手写自己的Vuex
    limitPNG压缩图片
    swiper兼容性ie浏览器出现的问题
    postcss-pxtorem
    【Other】Win10防火墙放行Docker(WSL2)端口
    docker容器内使用apt-get报错
    docker+mysql
    docker部署+验证码错误
  • 原文地址:https://www.cnblogs.com/JD85/p/2825037.html
Copyright © 2011-2022 走看看