Questions tagged [libuv]

libuv is a platform layer for Node written in C. Its purpose is to abstract IOCP on Windows and libev-like functionality on Unix systems.

libuv is a platform layer for node.js written in C. Its purpose is to abstract IOCP on Windows and libev on Unix systems. It is intended to eventually contain all platform differences in this library.

400 questions
0
votes
1 answer

libuv: uv_close and thread safety

I've seen it mentioned that "uv_close is not thread safe". I'm experienced with writing multi-threaded C/C++ code, but I'm still not sure what is being said here. Does this mean that uv_close must always be called in the main thread? Or, is this…
logidelic
  • 1,525
  • 15
  • 42
0
votes
1 answer

Ensure asynchonous callback is called by libuv

The documentation of libuv states: libuv will coalesce calls to uv_async_send(), that is, not every call to it will yield an execution of the callback. For example: if uv_async_send() is called 5 times in a row before the callback is called,…
sigy
  • 2,408
  • 1
  • 24
  • 55
0
votes
1 answer

libuv slow in establishing a multiple connections?

I am trying to evaluate the performance of libuv because of the promise that it can manage 100,000 of TCP sockets and can generate 10,000 of new TCP sessions/second. Created the following code snippet based on a gist to validate the performance of…
packetie
  • 4,839
  • 8
  • 37
  • 72
0
votes
1 answer

Using uv_close instead of uv_async_send for single use uv_async callbacks?

My understanding is that the proper use of uv_async for a single use is the following: Allocate the uv_async_t handle; call uv_async_init on the allocated handle; call uv_async_send to schedule the callback; unregister the handle using…
GaspardP
  • 4,217
  • 2
  • 20
  • 33
0
votes
1 answer

UWP application refuses to receive data in P2P server part

I am trying to create P2P(UDP) windows 10 UWP application written in c++ using networking library written in C (tried both enet and libuv). The problem is when the app is acting like client everything works as expected, but when I am testing the…
Gabriel kotev
  • 369
  • 3
  • 15
0
votes
1 answer

How can I check if IOCP is enabled?

I built libuv on windows and I'd like to make sure if IOCP is enabled and using properly. How can I check it? Is there any function to check? I tried to look for any preprocessor in VC setting but coundn't find it. Thanks.
GT Kim
  • 329
  • 1
  • 4
  • 16
0
votes
1 answer

SO_REUSEPORT on macOS with libuv

the SO_REUSEPORT option not works on macOS with libuv. uv_loop_init uv_tcp_init_ex uv_fileno // get fd int option_value = 1; setsockopt(fd, SOL_SOCKET, SO_REUSEPORT, &option_value, sizeof (int) uv_tcp_bind uv_thread_create 4 I see 4 same address and…
whisper
  • 143
  • 2
  • 9
0
votes
1 answer

Why stdin blocks the whole event loop without writing to it?

Recently I'm working for a project which requires monitoring several child processes' stdout simultaneously and write stdin, too. In order to make it, I use pyuv as event loop running on the background thread, and add handles of child process…
DemoHn
  • 23
  • 4
0
votes
2 answers

libuv has memory leaks in simpliest example?

I took the code snippet from libuv-book https://nikhilm.github.io/uvbook/basics.html and tested it for memory leaks with next simple code: #define _CRTDBG_MAP_ALLOC #include #include #include #include int…
kyb
  • 7,233
  • 5
  • 52
  • 105
0
votes
1 answer

how to break a long callback chain in libuv

Suppose that we receive data from TCP socket, and process it step by step to get the result. Each step is implemented as a function which tasks parameter from the previous and return result to the next. We chain all these functions as a callback…
Douglas Su
  • 3,214
  • 7
  • 29
  • 58
0
votes
1 answer

Can you prioritize events in libuv?

Let's say I have 2 sockets I am watching for events and I really want socket 1 to be preferred (event at the cost of starving socket 2). How would I do that with libuv ? As an example when working with libevent one can use : int…
Alex Garcia
  • 773
  • 7
  • 21
0
votes
1 answer

Undefined symbols when building libuv

I need to use libuv with my library. Since I cannot link it two static libraries I decided to include the source for libuv along with my code. I have a .cmake file that downloads libuv, checks out the right tag and adds the source files to a…
ruipacheco
  • 15,025
  • 19
  • 82
  • 138
0
votes
1 answer

libuv timer:i can not get the output from console

I am newer to libuv. Today i meet a question that i can not get the outout from console. this is my code: #include #include #include void timer_cb(uv_timer_t *handle, int status); int main() { uv_loop_t *loop; loop…
strucoder
  • 61
  • 6
0
votes
2 answers

Using a pointer to Isolate in libuv worker thread

I try to develop an async Node.js addon that works with an Isolate. Consider this example code: struct Work { uv_work_t request; Persistent callback; Isolate * isolate; }; // called in worker thread static void WorkAsync(uv_work_t…
Josef Zamrzla
  • 183
  • 1
  • 2
  • 11
0
votes
1 answer

where the body of function uv_prepare_invoke, only find define in libuv

I read the libuv sourcecode and found these function declarations: void uv_prepare_invoke(uv_loop_t* loop); void uv_check_invoke(uv_loop_t* loop); void uv_idle_invoke(uv_loop_t* loop); Defined in internal.h. But I can't find the function bodies,…
张立伟
  • 57
  • 4