[Libwebsockets] Exception when trying to start uv_timer_start in libwebsockets libuv example

Meir Yanovich meiry242 at gmail.com
Thu Jul 21 08:19:18 CEST 2016


Hello
Im using the libuv and libsockets example , and i try to start new timer to
work in parallel with the lws loop . im don't realy know if i do it right
and if there is any problem any way this is what i did
Because the libuv uv_timer_start  mechanism needs the uv_loop_t* loop
i checked how it is implemented inside the lws_uv_initloop . and did this :

#include "private-libwebsockets.h"
....
....

loop = lws_malloc(sizeof(*loop));
loop_r = uv_loop_init(loop);
uv_timer_init(loop, &timeout);
if (lws_uv_initloop(context, loop, 0)) {
lwsl_err("lws_uv_initloop failed\n");

goto bail;
}
lwsl_notice("server started\n");

r = uv_timer_start(&timer_handle, &timer_cb, 0, 0);   // HERE IS THE
EXCEPTION
lws_libuv_run(context, 0);


But when it Reaches to uv_timer_start it throw exception
which looks like this :

First-chance exception at 0x00D55919 in
libuv_libwebsocket_cocos2dx_server.exe: 0xC0000005: Access violation
reading location 0x00000024.
Unhandled exception at 0x00D55919 in
libuv_libwebsocket_cocos2dx_server.exe: 0xC0000005: Access violation
reading location 0x00000024.

And if i try to debug it it thrown from libuv : timer.c  line 102
in uv_timer_start
in this line :  handle->due = get_clamped_due_time(loop->time, timeout);

can you please clarify if it is related to the lws or not ?
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://libwebsockets.org/pipermail/libwebsockets/attachments/20160721/ed05c778/attachment.html>


More information about the Libwebsockets mailing list