Commit 81dac4db authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(end_of_atomic): Now returns a struct timeval, not a long.

parent 9517e1c9
/* /*
* $Id: disk-end-of-atomic.c,v 0.25 2003/07/12 00:17:37 ceder Exp $ * $Id: disk-end-of-atomic.c,v 0.26 2003/07/12 21:29:25 ceder Exp $
* Copyright (C) 1991-1994, 1998-1999, 2001-2002 Lysator Academic Computer Association. * Copyright (C) 1991-1994, 1998-1999, 2001-2002 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -54,11 +54,12 @@ ...@@ -54,11 +54,12 @@
#include "server/smalloc.h" #include "server/smalloc.h"
#include "kom-config.h" #include "kom-config.h"
#include "param.h" #include "param.h"
#include "timeval-util.h"
long struct timeval
end_of_atomic(void) end_of_atomic(void)
{ {
long timeout; struct timeval timeout;
static int limit = 0; static int limit = 0;
int parts_left; int parts_left;
...@@ -73,8 +74,9 @@ end_of_atomic(void) ...@@ -73,8 +74,9 @@ end_of_atomic(void)
for (parts_left = param.saved_items_per_call; parts_left > 0; --parts_left) for (parts_left = param.saved_items_per_call; parts_left > 0; --parts_left)
{ {
if ((timeout = sync_part()) != 0) timeout = sync_part();
return 1000 * timeout; if (timeval_nonzero(timeout))
return timeout;
} }
return param.synctimeout; return param.synctimeout;
} }
/* /*
* $Id: end-of-atomic.h,v 0.4 2003/07/12 00:17:40 ceder Exp $ * $Id: end-of-atomic.h,v 0.5 2003/07/12 21:28:33 ceder Exp $
* Copyright (C) 1991 Lysator Academic Computer Association. * Copyright (C) 1991 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -23,14 +23,18 @@ ...@@ -23,14 +23,18 @@
* Please mail bug reports to bug-lyskom@lysator.liu.se. * Please mail bug reports to bug-lyskom@lysator.liu.se.
*/ */
/* /*
* $Id: end-of-atomic.h,v 0.4 2003/07/12 00:17:40 ceder Exp $ * $Id: end-of-atomic.h,v 0.5 2003/07/12 21:28:33 ceder Exp $
* *
* end-of-atomic.c * end-of-atomic.c
*/ */
/* /*
* Return value X: end_of_atomic() should be called again within the * Clean up after an atomic request. This will throw things from the
* next X milliseconds. * cache, free memory allocated with tmp_alloc(), and save part of the
* database. The function should be called after every atomic
* request, and it should also be called periodically; the caller
* should wait no more than the return value before the function is
* called again.
*/ */
long struct timeval
end_of_atomic(void); end_of_atomic(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