Commit e6ce93ef authored by Per Cederqvist's avatar Per Cederqvist
Browse files

All these changes are only in effect if DEBUG_CALLS is defined:

Include services.h and manipulate.h.
(block_after_pre_sync): New static variable.
(save_one_conf): Return immediately if block_after_pre_sync is true.
(cache_sync_all): Crash if block_after_pre_sync is true.
(cache_sync_start): New request.
(cache_sync_finish): New request.
parent 9fbe760f
/*
* $Id: simple-cache.c,v 0.100 2002/11/04 23:20:00 ceder Exp $
* $Id: simple-cache.c,v 0.101 2003/01/10 01:08:15 ceder Exp $
* Copyright (C) 1991-2002 Lysator Academic Computer Association.
*
* This file is part of the LysKOM server.
......@@ -89,6 +89,10 @@
#include "server-time.h"
#include "eintr.h"
#ifdef DEBUG_CALLS
# include "services.h"
# include "manipulate.h"
#endif
/*
* Possible improvements:
*
......@@ -166,6 +170,13 @@ static Text_no highest_text_no = 0;
BUGDECL;
#ifdef DEBUG_CALLS
/* This is used by cache_sync_start() and cache_sync_finish(). */
static int block_after_pre_sync = 0;
#endif
/* Define LOGACCESSES if you want to be able to log all accesses to
the data base. */
......@@ -2044,6 +2055,11 @@ save_one_conf(void)
{
Cache_node *cn;
#ifdef DEBUG_CALLS
if (block_after_pre_sync)
return;
#endif
#ifdef FASTSAVE
if (next_conf_to_sync < highest_conf_no)
#else
......@@ -2858,11 +2874,50 @@ cache_sync_all(void)
if (param.never_save)
return;
#ifdef DEBUG_CALLS
if (block_after_pre_sync)
restart_kom("cache_sync_all: block_after_pre_sync is set!\n");
#endif
pre_sync();
while ( sync_part() != TRUE )
;
}
#ifdef DEBUG_CALLS
/* Do pre_sync(), but stop after that. Nothing will actually be saved
until cache_sync_finish() is called. You must call
cache_sync_finish() before shutting down the server or attempting
to use sync_kom(). */
extern Success
cache_sync_start(void)
{
CHK_CONNECTION(FAILURE);
block_after_pre_sync = 1;
pre_sync();
return OK;
}
/* This should only be called afrer a call to cache_sync_start().
Stop being blocked and save everything. */
extern Success
cache_sync_finish(void)
{
CHK_CONNECTION(FAILURE);
block_after_pre_sync = 0;
while (sync_part() != TRUE)
;
return OK;
}
#endif
void
free_all_cache (void)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment