update: Set thread stack size to 512 KiB

Empire 2 settled on this formula for the stack size:

	stacksize = 100000 +
    /* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
					    sizeof(char *));

Obviously attempts to provide space for a known configuration-
dependent stack hog.  The hog went away when finish_sects()'s arrays
became dynamically allocated in 4.2.0.

Adjusting for that by dropping the extra term might well do (I observe
only a few KiB of stack used on my system).  But let's set it to 512
KiB instead to be on the safe side.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2014-01-06 15:26:24 +01:00
parent 030b374db7
commit 0f84c009bf

View file

@ -69,7 +69,6 @@ void
update_init(void) update_init(void)
{ {
struct player *dp; struct player *dp;
int stacksize;
update_schedule_anchor = (time(NULL) + 59) / 60 * 60; update_schedule_anchor = (time(NULL) + 59) / 60 * 60;
if (update_get_schedule() < 0) if (update_get_schedule() < 0)
@ -78,11 +77,7 @@ update_init(void)
dp = player_new(-1); dp = player_new(-1);
if (!dp) if (!dp)
exit_nomem(); exit_nomem();
/* FIXME ancient black magic; figure out true stack need */ update_thread = empth_create(update_sched, 512 * 1024, 0, "Update", dp);
stacksize = 100000 +
/* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
sizeof(char *));
update_thread = empth_create(update_sched, stacksize, 0, "Update", dp);
if (!update_thread) if (!update_thread)
exit_nomem(); exit_nomem();
} }