示例#1
0
bool rpc_stream::receive(rpc_message* msg)
{
  if(try_receive(msg) <= 0) {
    return false;
  }
  return true;
}
示例#2
0
static void try_readf() {	
	char msg[256];
	while (1) {
		while (try_receive (msg) >= 0)
			kprint ("%s", msg);
	}
}
void CChildView::OnPaint() 
{
   CPaintDC dc(this); // device context for painting

   // If the unbounded_buffer object contains a Bitmap object, 
   // draw the image to the client area.
   BitmapPtr pBitmap;
   if (try_receive(m_MandelbrotImages, pBitmap))
   {
      if (pBitmap != NULL)
      {
         // Draw the bitmap to the client area.
         Graphics g(dc);
         g.DrawImage(pBitmap.get(), 0, 0);
      }
   }
   // Draw the image on a worker thread if the image is not available.
   else
   {
      RECT rc;
      GetClientRect(&rc);
      m_DrawingTasks.run([rc,this]() {
         DrawMandelbrot(BitmapPtr(new Bitmap(rc.right, rc.bottom)));
      });
   }
}
示例#4
0
void terminal_func() {
    char* str = (char*) kcalloc (256, sizeof (char));
    int retv = -1;
    res_type_t type = res_compose (RES_CPU, 0, 0, 0);
    int prd;
    while(1) {
        GET_RES (prd, type, 3, R_WAITFROM);
        //dump_rbuffer(GET_KERNEL_THREAD()->buffer, msg_d);
        while (try_receive (str) >= 0)
            kprint ("%s", str);
        GIVE_RES (prd, type, 3, R_SENDTO);
    }
}