Hi all,
    I code my example following src/vpp-api/client, but do {vac_read}while(1) 
often block when the results-num does not know. 
It shows  pthread_cond_wait when gdb.
Help please! 
Thanks very much!

void printIntefaces()
{
  api_main_t * am = &api_main;
  vl_api_sw_interface_dump_t message;
  M_NOALLOC(SW_INTERFACE_DUMP);
  message.name_filter_valid = 0;
  strcpy(message.name_filter, "Gigabit");
  vac_write((char *)&message, sizeof(message));
  char* pMsg = NULL;
  int nLen = 0;
  int ret = 0;
  int nCount = 0;
  do  {
    printf("begin interface read .. \n");
    ret = vac_read(&pMsg, &nLen, 1);
    printf("begin interface end .. \n");
    if(ret != -1)
      {
    vl_api_sw_interface_details_t* pSV = (vl_api_sw_interface_details_t*)pMsg;
    printf("%lu:%s  \n", ntohl(pSV->sw_if_index), pSV->interface_name);
      vac_free(pMsg);
        nCount += 1;
      } 
    else{
      break;
    }
  }while(1);
 printf("get real count[%d] \n", nCount);
}



wangchuan...@163.com
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#10465): https://lists.fd.io/g/vpp-dev/message/10465
Mute This Topic: https://lists.fd.io/mt/25510961/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to