GC Bug? Error: Unable to accept socket connection: Interrupted system call

Huang Guan gdxxhg at gmail.com
Sat Jun 7 08:03:47 PDT 2008


I got this error under Linux while I didn't find it under Windows.

This is the code:


private import std.thread, std.stdio, std.gc, std.c.time, std.socket;


Socket s;
int test(void* arg){
	s.bind( new InternetAddress( 8888 ) );
	s.listen(10);
	Socket a = s.accept();
	// never reach
	return 0;
}

int main()
{
	s = new TcpSocket();
	Thread th = new Thread( &test, null, 0 );
	th.start();
	sleep(1);
	std.gc.genCollect(); //raise error.
	return 0;
}

Obviously this problem occurred in std.gc.genCollect( or std.gc.fullCollect ).
I am writing a server program and I met this problem and I am very sad now!!

My server runs under Windows well on some machines but it always raises errors under Linux unless I disable gc!!!
Became a little hate phobos :-(  
Help me please!!




More information about the Digitalmars-d mailing list