Method: NNG::Socket::Rep0#get_msg

Defined in:
ext/rbnng/rep0.c

#get_msgObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'ext/rbnng/rep0.c', line 47

static VALUE
socket_rep0_get_msg(VALUE self)
{
  RbnngSocket* p_rbnngSocket;
  Data_Get_Struct(self, RbnngSocket, p_rbnngSocket);
  int rv =
    rb_thread_call_without_gvl(rep0_get_msg_blocking, p_rbnngSocket, 0, 0);

  if (rv == 0) {
    RbnngMsg* p_newMsg;
    VALUE newMsg = rb_class_new_instance(0, 0, rbnng_MsgClass);
    Data_Get_Struct(newMsg, RbnngMsg, p_newMsg);
    p_newMsg->p_msg = p_rbnngSocket->p_getMsgResult;
    return newMsg;
  } else {
    raise_error(rv);
    return Qnil;
  }
}