Re: callback and thread



Soeren Sandmann <sandmann daimi au dk> writes:

while (1)
{
  Calculation *c;
  gpointer r;

  c = queue_read (); /* blocks if queue is empty, but that is OK */

  r = c->do_calculation (c->data);

  gtk_idle_add (c->return_func, c);
}

This should be 

while (1)
{
  Calculation *c;

  c = queue_read (); /* blocks if queue is empty, but that is OK */

  c->data = c->do_calculation (c->data);

  gtk_idle_add (c->return_func, c);
}

The function c->return_func should be responsible for freeing c.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]