Asyncronous messages and usleep

Scott Schmeisser <[email protected]> Thu, 5 Sep 2002 18:00:34 -0400
Newsgroups gmane.comp.gnome.ximian.soup
Message-ID <7CC4A43A1F299C45B7FDFEBD02E43B71F5669B@srvmail-mtl.montreal.ubisoft.org>
I'm trying to send asynchronous messages and I'm running into a problem.
Everything works fine as long as my program doesn't try to sleep while
waiting for the response.

For example, the following code works fine with the usleep(1) commented out.
The SoupMessageCallback eventually gets called and exits out of the program.
If I leave in the usleep(1), 9 times out of 10 the program never exits and
prints "status:4 errorcode:100 errorclass:2" endlessly.  It never seems to
run g_main_iteration() anymore either since there are no more pending
events.

---------
soup_message_queue(pMessage,SoupMessageCallback,NULL);
while (true)
{
	while (g_main_pending())
	{
		printf("Running g_main\n");
		g_main_iteration(true);
	}
	printf("status:%i errorcode:%i errorclass:%i\n",pMessage->status,
			pMessage->errorcode,pMessage->errorclass);
	usleep(1);
}
----------
If anyone could help point me in the right direction in the libsoup source
code I'm more then happy to look.  In fact I've been doing so all day and
finally decided to ask for help. :(

I'm using libsoup version 0.7.4.

_______________________________________________
Soup-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/soup-list