コード例 #1
0
ファイル: events.c プロジェクト: UnderSampled/RAOAMUCK
void
check_dump_time(void)
{
	long currtime = (long) time((time_t *) NULL);

	if (!last_dump_time)
		last_dump_time = (long) time((time_t *) NULL);

	if (!dump_warned) {
		if (((last_dump_time + tp_dump_interval) - tp_dump_warntime)
			< currtime) {
			dump_warning();
			dump_warned = 1;
		}
	}

	if ((last_dump_time + tp_dump_interval) < currtime) {
		last_dump_time = currtime;
		add_property((dbref) 0, "_sys/lastdumptime", NULL, (int) currtime);

		if (tp_periodic_program_purge)
			free_unused_programs();
		purge_for_pool();
		purge_try_pool();

#ifdef DELTADUMPS
		dump_deltas();
#else
		fork_and_dump();
#endif

		dump_warned = 0;
	}
}
コード例 #2
0
ファイル: events.c プロジェクト: fuzzball-muck/fuzzball
/**
 * Checks if its time to take a dump, among other things.
 *
 * If its time to dump, we also:
 *
 *   * set a last dumped at property
 *   * free unused programs (@see free_unused_programs) if enabled
 *   * purge_for_pool and purge_try_pool
 *     (@see purge_for_pool @see purge_try_pool)
 *
 * The actual dump is fork_and_dump ... @see fork_and_dump
 *
 * @private
 */
static void
check_dump_time(void)
{
    time_t currtime = (time_t) time((time_t *) NULL);

    if (!last_dump_time)
        last_dump_time = (time_t) time((time_t *) NULL);

    /*
     * @TODO There is a lot of overlap here in calculating times
     *       with next_dump_time -- this function should use
     *       next_dump_time instead of having copy-paste versions of
     *       all the code in next_dump_time
     */

    if (!dump_warned) {
        if (((last_dump_time + tp_dump_interval) - tp_dump_warntime)
            < currtime) {
            dump_warning();
            dump_warned = 1;
        }
    }

    if ((last_dump_time + tp_dump_interval) < currtime) {
        last_dump_time = currtime;
        add_property((dbref) 0, SYS_LASTDUMPTIME_PROP, NULL, (int) currtime);

        if (tp_periodic_program_purge)
            free_unused_programs();

        purge_for_pool();
        purge_try_pool();

        fork_and_dump();

        dump_warned = 0;
    }
}