Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Michele Caini
    @skypjack
    You've to download, compile and link libuv in your project
    This is the main problem at the moment :-)
    Michele Caini
    @skypjack
    FYI I'm porting uvw to C++17, I won't support anymore the C++14 version
    Michele Caini
    @skypjack
    I've just released uvw v2.3.0 backed by libuv v1.34.0 :)
    Sergiu Giurgiu
    @sgiurgiu
    @skypjack Hi, I have a "best practice" question about uwv and most likely libuv since I'm not familiar with any of them and I just started using them in a project of mine.
    Sergiu Giurgiu
    @sgiurgiu
    I am doing directory reading with uvw, using opendir/readdir/closedir APIs. I would like to recursively traverse directories as I encounter them to gather data. As I'm gathering right now from the API, I can only do one opendir/readdir/closedir operation on a directory on a FsReq resource at a time.
    What would be the impact of just creating a new FsReq resource any time I encounter a dir and start the gathering operation on it at that time?
    Is it an expensive resource? With a directory with thousands of subdirectories will it bring the computer to a halt? Or is it designed for such a usage and this would be the recommended approach?
    Michele Caini
    @skypjack
    uvw is a tiny wrapper around libuv, the cost of creating the class is ridiculous but the cost of making the actual call doesn't depend on uvw
    I've no idea actually if it's expensive or not, I'm not that much in the libuv internals, I'm sorry
    RUSshy
    @RUSshy
    rider64_OPtl6YQEjN.png
    hi, i am using uvw as a header file, i have already setup libuv as a static library in my cmake project, using msvc it complains about lot of stuff
    i feel like i missed one step but i don't see what, i'm not familiar with cmake
    RUSshy
    @RUSshy
    ohh nvm, i put it in the wrong folder
    hmm next thing i don't get is i consume already libuv as a static library, and when using uvw it complains about not finding libuv.dll
    Michele Caini
    @skypjack
    If you use uvw as header only, it doesn't include and link libuv for you
    That's why the linker complains :)
    RUSshy
    @RUSshy
    i did that already: target_link_libraries(${PROJECT_NAME} PRIVATE opengl32 glad glfw arc cmn ws2_32 uv)
    oh i think i got it uv => uv_a :trollface:
    ok that was that, it works fine now!
    Michele Caini
    @skypjack
    :+1:
    DuckVador
    @DuckVador
    图片.png
    this test cause double free, when call h->type(). I'm wondering what is the reason.
    Michele Caini
    @skypjack
    is it one of the tests from uvw or one you wrote?
    DuckVador
    @DuckVador
    my own test
    Michele Caini
    @skypjack
    ok, did you try with an interval that is larger than 0ms?
    DuckVador
    @DuckVador
    still double free
    actually, if I call h->active, seems everything is ok.
    I pasted my code here :https://pastebin.com/raw/3xeJHfmp
    Commander Keen
    @madhat1
    Hello people, I'm wondering where I can find real world samples of using UVW.
    Official documentation shows an example of a TCP server, I'm looking for Timer and File I/O examples.
    Michele Caini
    @skypjack
    GitHub contains many example if you like
    Commander Keen
    @madhat1
    I couldn't find timer and file I/O examples, can you direct me to them?
    smalls12
    @smalls12
    I can't figure out how to create a PollHandle for polling a socket to indicate when something is ready to be read
    I don't see any examples, and the tests only test FsPollHandle
    Michele Caini
    @skypjack
    @smalls12 uvw doesn't add up on libuv, if you know how to do that with the latter, you can just translate it to the former
    PollHandle offers start and stop as expected and they work exactly as their counterparts in libuv
    smalls12
    @smalls12
    I should provide more context
    I am trying to integrate a 3rdparty library with libuv / uvw similar to how I would use boost::asio
    basically I just want the libuv event loop to tell me when there is something to read or write and hand that off to the 3rdparty library
    Michele Caini
    @skypjack
    This doesn't really add much :slight_smile: the documentation for a poll handle in libuv is here, with uvw it's just a matter of invoking a member function rather than a free function
    You pass a file descriptor to the constructor and invoke start, that's it
    Events are sent when something relevant happens, you can listen to them with a callback
    All this stuff is described in the readme file though and it's literally the same for all classes
    How you obtain a file descriptor doesn't depende on libuv nor uvw, so it's up to you
    smalls12
    @smalls12
    I'll post the code I have tried when I get back infront of it
    smalls12
    @smalls12
    I'm back looking at this now
    this is the code I have tried, it is seg faulting on me
    auto loop = uvw::Loop::getDefault();
    
        auto poller = loop->resource<uvw::PollHandle>(fd);
        poller->on<uvw::PollEvent>(
        [](const auto &, auto &req)
        {
            std::cout << "poller - some event?\n";
        });
    
        if(poller->init())
        {
            std::cout << "poller - initialized?\n";
            poller->start(uvw::PollHandle::Event::READABLE);
        }
        else
        {
            std::cerr << "poller - error?\n";
        }
    
        loop->run();
    is this what you expected?
    fd is the file descriptor from the other library
    Michele Caini
    @skypjack
    No, it's not expected but it's hard to tell what the problem is without a reproducible example. From what I can see, it can be in uvw, it can be in the other library, it can be elsewhere in the middle...
    smalls12
    @smalls12
    ok the fd was actually -1