/* * call-seq: * poll -> bool * * Returns +true+ if there are any messages waiting to be read, and * +false+ otherwise. If #poll returns +true+, #receive can be called * without blocking. */ static VALUE spconn_poll(VALUE obj) { int n; struct SpreadConnection *sp; Data_Get_Struct(obj, struct SpreadConnection, sp); if ((n = SP_poll(sp->mbox)) < 0) raise_sp_error(n); return INT2BOOL(n); }