libthread: get rid of chaninit() (thanks qrstuv)
chaninit() does not initialize Chan.qentry and Chan.nentry and there is no way to get rid of such a channel. nobody is using it, so removing the function to avoid confusion.
This commit is contained in:
parent
eaf91d0f8e
commit
07c7fa6716
3 changed files with 2 additions and 24 deletions
|
@ -63,7 +63,6 @@ int alt(Alt alts[]);
|
||||||
int chanclose(Channel*);
|
int chanclose(Channel*);
|
||||||
int chanclosing(Channel *c);
|
int chanclosing(Channel *c);
|
||||||
Channel*chancreate(int elemsize, int bufsize);
|
Channel*chancreate(int elemsize, int bufsize);
|
||||||
int chaninit(Channel *c, int elemsize, int elemcnt);
|
|
||||||
void chanfree(Channel *c);
|
void chanfree(Channel *c);
|
||||||
int chanprint(Channel *, char *, ...);
|
int chanprint(Channel *, char *, ...);
|
||||||
long decref(Ref *r); /* returns 0 iff value is now zero */
|
long decref(Ref *r); /* returns 0 iff value is now zero */
|
||||||
|
|
|
@ -4,7 +4,6 @@ alt,
|
||||||
chanclose,
|
chanclose,
|
||||||
chancreate,
|
chancreate,
|
||||||
chanfree,
|
chanfree,
|
||||||
chaninit,
|
|
||||||
chanclosing,
|
chanclosing,
|
||||||
chanprint,
|
chanprint,
|
||||||
mainstacksize,
|
mainstacksize,
|
||||||
|
@ -107,7 +106,6 @@ char* threadgetname(void)
|
||||||
void** threaddata(void)
|
void** threaddata(void)
|
||||||
void** procdata(void)
|
void** procdata(void)
|
||||||
.XX
|
.XX
|
||||||
int chaninit(Channel *c, int elsize, int nel)
|
|
||||||
Channel* chancreate(int elsize, int nel)
|
Channel* chancreate(int elsize, int nel)
|
||||||
void chanfree(Channel *c)
|
void chanfree(Channel *c)
|
||||||
.XX
|
.XX
|
||||||
|
@ -384,10 +382,8 @@ operation blocks until the corresponding
|
||||||
.I recv
|
.I recv
|
||||||
operation occurs and
|
operation occurs and
|
||||||
.IR "vice versa" .
|
.IR "vice versa" .
|
||||||
.I Chaninit
|
.I Chancreate
|
||||||
initializes a
|
allocates a new channel for messages of size
|
||||||
.B Channel
|
|
||||||
for messages of size
|
|
||||||
.I elsize
|
.I elsize
|
||||||
and with a buffer holding
|
and with a buffer holding
|
||||||
.I nel
|
.I nel
|
||||||
|
@ -395,8 +391,6 @@ messages.
|
||||||
If
|
If
|
||||||
.I nel
|
.I nel
|
||||||
is zero, the channel is unbuffered.
|
is zero, the channel is unbuffered.
|
||||||
.IR Chancreate
|
|
||||||
allocates a new channel and initializes it.
|
|
||||||
.I Chanfree
|
.I Chanfree
|
||||||
frees a channel that is no longer used.
|
frees a channel that is no longer used.
|
||||||
.I Chanfree
|
.I Chanfree
|
||||||
|
|
|
@ -49,21 +49,6 @@ chanfree(Channel *c)
|
||||||
unlock(&chanlock);
|
unlock(&chanlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
chaninit(Channel *c, int elemsize, int elemcnt)
|
|
||||||
{
|
|
||||||
if(elemcnt < 0 || elemsize <= 0 || c == nil)
|
|
||||||
return -1;
|
|
||||||
c->f = 0;
|
|
||||||
c->n = 0;
|
|
||||||
c->closed = 0;
|
|
||||||
c->freed = 0;
|
|
||||||
c->e = elemsize;
|
|
||||||
c->s = elemcnt;
|
|
||||||
_threaddebug(DBGCHAN, "chaninit %p", c);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Channel*
|
Channel*
|
||||||
chancreate(int elemsize, int elemcnt)
|
chancreate(int elemsize, int elemcnt)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue