[nanomsg] Re: Questions nn functions inside thread

  • From: Ranier VF <ranier_gyn@xxxxxxxxxxx>
  • To: "nanomsg@xxxxxxxxxxxxx" <nanomsg@xxxxxxxxxxxxx>
  • Date: Mon, 9 Mar 2015 23:26:14 +0000

Hi Garret,
Don´t worry, I am happy with your answers, thank you.With respect to debug, is 
possible with ipc, all right.
Maybe you can help with this:on src\devices\tcpmuxd.c, line 327
static int nn_tcpmuxd_send_fd (int s, int fd) -> function signature
but in line 239, rc = nn_tcpmuxd_send_fd (tc->fd, conn);
Call tcpmuxd with wrong parameters?
would be correct?rc = nn_tcpmuxd_send_fd (conn, tc->fd);
Second:new device, handle new connections and start new thread to consume 
connection.
with conn = accept, we have raw socket.
Question how pass raw socket (new connection) to nanomsg internal structure?
We don´t call nn_socket and nn_connect, on new thread?
On tcpmuxd, nn_tcpmuxd_send_fd is used to pass raw socket, but I think,it would 
not be the right solution in which case.
Best regards,
Ranier Vilela
From: garrett@xxxxxxxxxx
Subject: [nanomsg] Re: Questions nn functions inside thread
Date: Mon, 9 Mar 2015 05:30:18 -0700
To: nanomsg@xxxxxxxxxxxxx

If you’re debugging the internals of nanomsg, then you need to spend some time 
learning the asynchronous architecture it uses under the hood.  Otherwise, if 
you’re just debugging your application, step *over* the function calls rather 
than through them.
I can’t really help you further here, since I don’t do Windows.
        - Garrett
On Mar 9, 2015, at 5:08 AM, Ranier VF <ranier_gyn@xxxxxxxxxxx> wrote:Hi,I 
noticed this, with windbg (Microsoft Debugger), step by step (F8 step into).
With IPC, is possible debug, but on call nn_close, debugger (F10 step over) 
jump to another thread (main?) and is and was no longer possible continue with 
debug on app function.
With TCP, is not possible debug with windbg, on call nn_recv, debugger stop 
withAccess Violation (WSPSend), but in runtime works well, or without GPF.
Best regards,
Ranier Vilela

From: garrett@xxxxxxxxxx
Subject: [nanomsg] Re: Questions nn functions inside thread
Date: Thu, 5 Mar 2015 13:34:12 -0800
To: nanomsg@xxxxxxxxxxxxx


On Mar 5, 2015, at 12:24 PM, Ranier VF <ranier_gyn@xxxxxxxxxxx> wrote:Hi,
Socket: PAIR
Protocol: IPCnn_connect inside a thread works, and flow continue to next line.
Protocol: TCPnn_connect inside a thread exit thread, and flow continue on main 
thread
Is by design?
The use of threads by libnanomsg is an implementation detail.  The behavior of 
your application and the API should be that nn_connect() operates 
asynchronously.  There may be some synchronous handling (for IPC this is 
easiest, for example, because you don’t have to wait for a network), but you 
should not rely on that.  The physical transport may or may not be connected 
when nn_connect() returns.  That *is* by design.

Protocol: IPCnn_close inside a thread exit thread!Is correct?
*That* seems weird.  Are you sure?  I don’t think it calls thr_exit().  
Although — if you call it from within one of the nn_xxx functions, that might 
be expected.

         - Garrett

Best regards,
Ranier Vilela
                                          

Other related posts: