Re: [gtk-list] Sockets and GTK 1.1.x



Mike Lindahl wrote:
> 
> Is there an easy way to solve the entire networking problem using
> signal-based sockets that is relatively easy to implement (either using
> GTK or some other thing, such as SIGIO) that anyone knows of??

If you are allowed/have access to libpthreads, create a wrapper function
to the receive function that's currently blocking...

Something like:

void *do_network_stuff (void *) {

  pthread_detach (pthread_self());
  do_network_read_function();

  return NULL;
}

and when you previously called your read function, call it with:

pthread_create (do_network_stuff());

Although there *ARE* more arguments to pthread_create than that, (I just
can't remember them off hand).

That should prevent the total block over gtk that your app previously
had.
However, I do get probs with updating a status bar like that - the
status bar itself only seems to refresh every time i focus/unfocus a
button! 
If anyone has any tips on how to solve that, I'd be grateful. 

My prob was using gtk 1.1.7, so it may have been solved since then.

Regards,

--
Lee.
http://atlas.cs.york.ac.uk/~lrpm100/



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