[prev in list] [next in list] [prev in thread] [next in thread]
List: 9fans
Subject: Re: [9fans] notes and traps
From: cinap_lenrek () gmx ! de
Date: 2008-08-30 18:09:49
Message-ID: 994ac677ae295f63e42e22b7cbbe5a70 () gmx ! de
[Download RAW message or body]
> i'm not convinced that you've explained why this change is
> correct or why it could solve the problem. after all, the
> NNOTED array is only 5 entries long. what if one gets 5
> user notes before the system note?
> do you kill the process (isn't this how it works now?),
> make notes unreliable or block the sender? none of these
> options seems like an improvement to me.
Hm, i think here would be a better way to handle it without
losing user notes while make sure internal system notes
get posted (and handled) in any case.
What if we change postnote to:
int
postnote(Proc *p, int dolock, char *n, int flag)
{
int x, s, ret;
Rendez *r;
Proc *d, **l;
if(dolock)
qlock(&p->debug);
if(flag != NUser){
x = 0;
if(p->nnote < NNOTE){
if(p->nnote)
memmove(&p->note[0], &p->note[1], p->nnote * sizeof(p->note[0]));
p->nnote++;
}
} else {
x = -1;
if(p->nnote+1 < NNOTE)
x = p->nnote++;
}
ret = 0;
if(x >= 0) {
strcpy(p->note[x].msg, n);
p->note[x].flag = flag;
ret = 1;
}
p->notepending = 1;
if(dolock)
qunlock(&p->debug);
...
In that case, if a external note is posted, we make sure here is
always room for one further internal note in the array. (see the
p->nnote+1 < NNOTE)
On arrival of a internal note, we move the rest down the array
and put our note in the first entry.
So the following conditions hold true:
- internal notes get *always* posted (so the process gets terminated
if its not handled or while in the note handler)
- we do not drop external notes on internal note arrival and the sender
can detect if posting the note failed.
- internal notes get not queued after external notes so they will be
handled by the next call to notify() and not tick notify() to think
that while processing a previous user note, that this caused an
internal note and kill the process before it has a chance to see the
that note.
Anything wrong here?
--
cinap
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic