예제 #1
0
IoValue *IoSocket_waitForConnect(IoSocket *self, IoValue *locals, IoMessage *m)
{
	IoState* state = (IoState*)self->tag->state;
	while(!self->isConnected)
	{	
		IoState_yield(state);
	}
	return (IoValue*)self;
}
예제 #2
0
IoValue *IoSocket_waitForReadLine(IoSocket *self, IoValue *locals, IoMessage *m)
{
	IoState* state = (IoState*)self->tag->state;
	while(!self->lineRead)
	{	
		IoState_yield(state);
	}
	IoValue* value = (IoValue*)USTRING(self->lineRead); 
	free(self->lineRead);
	self->lineRead = 0;
	return (IoValue*)value;
}
예제 #3
0
IoValue *IoSocket_connect(IoSocket *self, IoValue *locals, IoMessage *m)
{
	if(self->activeConnect)
	{
		delete self->activeConnect;
	}
	self->activeConnect = CConnectingSocket::NewL(self->socket, self);
	self->activeConnect->StartConnectL();
	IoState* state = (IoState*)self->tag->state;
	while(!self->isConnected)
	{	
		IoState_yield(state);
	}
	return (IoValue*)self;
}
예제 #4
0
IoValue *IoSocket_readLine(IoSocket *self, IoValue *locals, IoMessage *m)
{ 
    IoNumber *size = (IoNumber*)IoMessage_locals_numberArgAt_(m, locals, 0);
	IoState* state = (IoState*)self->tag->state;
	if(self->activeReadLine)
	{
		delete self->activeReadLine;
		self->activeReadLine = 0;
	}
	int trueSize = IoNumber_asInt(size);
	char* buffer = (char*)malloc(trueSize + 1);
	memset(buffer, 0, trueSize + 1);
	self->activeReadLine = CReadLineSocket::NewL(self->socket, self, buffer, trueSize);
	self->activeReadLine->StartReadLineL();
	while(!self->lineRead)
	{	
		IoState_yield(state);
	}
	IoValue* value = (IoValue*)USTRING(self->lineRead); 
	free(self->lineRead);
	self->lineRead = 0;
	return (IoValue*)value;

}
예제 #5
0
파일: IoSQLite3.c 프로젝트: JoeyButler/io
static int IoSQLite3_busyHandler(void *context, int n)
{
	IoSQLite3 *self = context;
	IoState_yield(IOSTATE);
	return 1;
}
예제 #6
0
파일: IoSQLite.c 프로젝트: Akiyah/io
static int IoSQLite_busyHandler(void *context, const char *s, int n)
{
	IoSQLite *self = context;
	IoState_yield(IOSTATE);
	return 1;
}