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

Andy Green andy at warmcat.com
Thu Jul 21 09:20:31 CEST 2016



On July 21, 2016 3:13:59 PM GMT+08:00, Meir Yanovich <meiry242 at gmail.com> wrote:
>Please Ignore my question , the libwebsockets looks like working fine
>with
>the libuv general framework .

Your reply arrived before the original email somehow.

I would have suggested looking at how the dumb-increment plugin does it.  Don't make your own loop use the lws libuv loop; all the apis used in the plugins are public

https://github.com/warmcat/libwebsockets/blob/master/plugins/protocol_dumb_increment.c

-Andy

>On Thu, Jul 21, 2016 at 9:19 AM, Meir Yanovich <meiry242 at gmail.com>
>wrote:
>
>> 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
>>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://libwebsockets.org/mailman/listinfo/libwebsockets
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://libwebsockets.org/pipermail/libwebsockets/attachments/20160721/e5f303da/attachment-0001.html>


More information about the Libwebsockets mailing list