added TCP_NODELAY socket option to communication sockets for messages to be sent immediately
git-svn-id: svn://anubis/fart/trunk@239 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
1 parent
95341049c8
commit
aaa38f6f2c
3 files changed
+138
-62
No files matched your search
+31
-32
@@ -139,37 +139,6 @@ int main(int argc, char * argv[])
|
||||
struct timeval before, after;
|
||||
gettimeofday(&before, NULL); /* start timing */
|
||||
|
||||
#if 0
|
||||
void Scene::taskLoop()
|
||||
{
|
||||
unsigned char data[3 * UNIT_TASK_SIZE];
|
||||
for (;;)
|
||||
{
|
||||
int task_id = m_distrib.getTask();
|
||||
if (task_id < 0)
|
||||
break;
|
||||
int pixel = task_id * UNIT_TASK_SIZE;
|
||||
int i = pixel / m_width;
|
||||
int j = pixel % m_width;
|
||||
for (int t = 0; t < UNIT_TASK_SIZE; t++)
|
||||
{
|
||||
renderPixel(j, i, &data[3 * t]);
|
||||
j++;
|
||||
if (j >= m_width)
|
||||
{
|
||||
j = 0;
|
||||
i++;
|
||||
if (i >= m_height)
|
||||
break;
|
||||
}
|
||||
}
|
||||
int ret = m_distrib.send_data(task_id, data, 3 * UNIT_TASK_SIZE);
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (distributed)
|
||||
{
|
||||
/* start the distribution infrastructure */
|
||||
@@ -186,11 +155,41 @@ void Scene::taskLoop()
|
||||
|
||||
the_distrib.startServer();
|
||||
the_distrib.startClients(client_options);
|
||||
/* TODO: wait until all tasks are complete */
|
||||
|
||||
/* wait until all tasks are complete */
|
||||
the_distrib.waitAllTasks();
|
||||
}
|
||||
else
|
||||
{
|
||||
the_distrib.startClient(server_name, server_port);
|
||||
|
||||
unsigned char data[3 * UNIT_TASK_SIZE];
|
||||
for (;;)
|
||||
{
|
||||
int task_id = the_distrib.getTask();
|
||||
if (task_id < 0)
|
||||
break;
|
||||
int pixel = task_id * UNIT_TASK_SIZE;
|
||||
int i = pixel / width;
|
||||
int j = pixel % width;
|
||||
for (int t = 0; t < UNIT_TASK_SIZE; t++)
|
||||
{
|
||||
scene.renderPixel(j, i, &data[3 * t]);
|
||||
j++;
|
||||
if (j >= width)
|
||||
{
|
||||
j = 0;
|
||||
i++;
|
||||
if (i >= height)
|
||||
break;
|
||||
}
|
||||
}
|
||||
int ret = the_distrib.send_data(task_id,
|
||||
&data[0],
|
||||
3 * UNIT_TASK_SIZE);
|
||||
if (ret != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in new issue
Block a user