summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h7
-rw-r--r--mbbsd/cache.c14
2 files changed, 11 insertions, 10 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index ea896dfd..1b1dc44e 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -1,4 +1,4 @@
-/* $Id: pttstruct.h,v 1.5 2002/04/03 17:41:10 in2 Exp $ */
+/* $Id: pttstruct.h,v 1.6 2002/04/04 18:02:24 ptt Exp $ */
#ifndef INCLUDE_STRUCT_H
#define INCLUDE_STRUCT_H
@@ -226,7 +226,8 @@ typedef struct userinfo_t {
int friend_online[MAX_FRIEND]; /* point到線上好友 utmpshm的位置 */
/* 好友比較的cache 前兩個bit是狀態 */
int reject[MAX_REJECT];
- int pad[3];
+ int pad[2];
+ int lock;
int friendtotal; /* 好友比較的cache 大小 */
unsigned char msgcount;
msgque_t msgs[MAX_MSGS];
@@ -292,7 +293,7 @@ typedef struct bcache_t {
boardheader_t bcache[MAX_BOARD];
boardheader_t *sorted[2][MAX_BOARD]; /* 0: by name 1: by class */
fileheader_t dircache[MAX_BOARD][DIRCACHESIZE];
- int busystate_b[MAX_BOARD];
+ time_t busystate_b[MAX_BOARD];
int total[MAX_BOARD];
int hbfl[MAX_BOARD][MAX_FRIEND + 1];
time_t lastposttime[MAX_BOARD];
diff --git a/mbbsd/cache.c b/mbbsd/cache.c
index bd380f19..374385e3 100644
--- a/mbbsd/cache.c
+++ b/mbbsd/cache.c
@@ -1,4 +1,4 @@
-/* $Id: cache.c,v 1.5 2002/04/03 17:41:12 in2 Exp $ */
+/* $Id: cache.c,v 1.6 2002/04/04 18:02:31 ptt Exp $ */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -565,12 +565,12 @@ void load_fileheader_cache(int bid, char *direct)
{
int num=getbtotal(bid);
int n = num-DIRCACHESIZE+1;
- if (brdshm->busystate!=1)
+ if (brdshm->busystate!=1 && brdshm->busystate_b[bid-1]!=1)
{
- brdshm->busystate = 1;
+ brdshm->busystate_b[bid-1] = 1;
get_records(direct, brdshm->dircache[bid - 1] ,
sizeof(fileheader_t),n<1?1:n, DIRCACHESIZE);
- brdshm->busystate = 0;
+ brdshm->busystate_b[bid-1] = 0;
}
else
{safe_sleep(1);}
@@ -679,10 +679,10 @@ void reset_board(int bid) { /* Ptt: 這樣就不用老是touch board了 */
if(--bid < 0)
return;
- if(brdshm->busystate) {
+ if(brdshm->busystate || brdshm->busystate_b[bid-1]) {
safe_sleep(1);
} else {
- brdshm->busystate = 1;
+ brdshm->busystate_b[bid-1] = 1;
bhdr = bcache;
bhdr += bid;
if((fd = open(fn_board, O_RDONLY)) > 0) {
@@ -696,7 +696,7 @@ void reset_board(int bid) { /* Ptt: 這樣就不用老是touch board了 */
bcache[i].firstchild[0]=NULL;
bcache[i].firstchild[1]=NULL;
}
- brdshm->busystate = 0;
+ brdshm->busystate_b[bid-1] = 0;
}
}