comparison src/lock.c @ 167:7ba337dafb2c noffle

[svn] * TODO,content.c,lock.c,server.c,server.h: Remove bug notice re: need to do a Cont_write on Lock_closeDatabases in case of unwritten content changes when releasing the lock. Update content to keep dirty flag and avoid unnecessary writes, and lock to signal server to re-read its group content info after the lock is released. Do NOT write content info on Lock_close if dirty, as the placeholder article in unsubscribed groups is currently done by adding it to the content when joining the group and deliberately not saving it unless another content modification takes place and thus causes the content to be saved.
author bears
date Sun, 25 Feb 2001 23:29:50 +0000
parents 8ea6b5ddc5a5
children c912e8288164
comparison
equal deleted inserted replaced
166:1d92abe57427 167:7ba337dafb2c
1 /* 1 /*
2 lock.c 2 lock.c
3 3
4 $Id: lock.c 249 2001-01-25 13:38:31Z bears $ 4 $Id: lock.c 260 2001-02-25 23:29:50Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
28 #endif 28 #endif
29 #endif 29 #endif
30 30
31 #include <unistd.h> 31 #include <unistd.h>
32 #include "configfile.h" 32 #include "configfile.h"
33 #include "content.h"
33 #include "log.h" 34 #include "log.h"
34 #include "database.h" 35 #include "database.h"
35 #include "group.h" 36 #include "group.h"
36 #include "request.h" 37 #include "request.h"
37 #include "portable.h" 38 #include "portable.h"
39 #include "server.h"
38 #include "util.h" 40 #include "util.h"
39 41
40 struct Lock 42 struct Lock
41 { 43 {
42 const char *name; 44 const char *name;
45 Bool doLazyLocking; 47 Bool doLazyLocking;
46 volatile Bool lazyClose; 48 volatile Bool lazyClose;
47 volatile Bool lazyLockBusy; 49 volatile Bool lazyLockBusy;
48 }; 50 };
49 51
50 static struct Lock globalLock = { "global", -1, "", TRUE }; 52 static struct Lock globalLock = { "global", -1, "", TRUE, FALSE, FALSE };
51 static struct Lock fetchLock = { "fetch", -1, "", FALSE }; 53 static struct Lock fetchLock = { "fetch", -1, "", FALSE, FALSE, FALSE };
52 54
53 static sig_t oldHandler = NULL; 55 static sig_t oldHandler = NULL;
54 56
55 /* Block/unblock SIGUSR1. */ 57 /* Block/unblock SIGUSR1. */
56 static Bool 58 static Bool
218 closeDatabases( void ) 220 closeDatabases( void )
219 { 221 {
220 Grp_close(); 222 Grp_close();
221 Db_close(); 223 Db_close();
222 Req_close(); 224 Req_close();
225 Server_flushCache();
223 releaseLock( &globalLock ); 226 releaseLock( &globalLock );
224 globalLock.lazyLockBusy = FALSE; 227 globalLock.lazyLockBusy = FALSE;
225 globalLock.lazyClose = FALSE; 228 globalLock.lazyClose = FALSE;
226 } 229 }
227 230