diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-03-04 10:20:31 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-03-04 10:20:31 +0100 |
commit | 07c7fa6716a2f54f9feab3eb56f8677edb1b033d (patch) | |
tree | 964ada16de707d78bd14309e864eb1e09d6aed8a /sys | |
parent | eaf91d0f8ef43344ea9b8b030ab1a446211b8d10 (diff) |
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.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/include/thread.h | 1 | ||||
-rw-r--r-- | sys/man/2/thread | 10 | ||||
-rw-r--r-- | sys/src/libthread/channel.c | 15 |
3 files changed, 2 insertions, 24 deletions
diff --git a/sys/include/thread.h b/sys/include/thread.h index 411a71a7d..5e02dcc3e 100644 --- a/sys/include/thread.h +++ b/sys/include/thread.h @@ -63,7 +63,6 @@ int alt(Alt alts[]); int chanclose(Channel*); int chanclosing(Channel *c); Channel*chancreate(int elemsize, int bufsize); -int chaninit(Channel *c, int elemsize, int elemcnt); void chanfree(Channel *c); int chanprint(Channel *, char *, ...); long decref(Ref *r); /* returns 0 iff value is now zero */ diff --git a/sys/man/2/thread b/sys/man/2/thread index 8bac0aa95..96cf19778 100644 --- a/sys/man/2/thread +++ b/sys/man/2/thread @@ -4,7 +4,6 @@ alt, chanclose, chancreate, chanfree, -chaninit, chanclosing, chanprint, mainstacksize, @@ -107,7 +106,6 @@ char* threadgetname(void) void** threaddata(void) void** procdata(void) .XX -int chaninit(Channel *c, int elsize, int nel) Channel* chancreate(int elsize, int nel) void chanfree(Channel *c) .XX @@ -384,10 +382,8 @@ operation blocks until the corresponding .I recv operation occurs and .IR "vice versa" . -.I Chaninit -initializes a -.B Channel -for messages of size +.I Chancreate +allocates a new channel for messages of size .I elsize and with a buffer holding .I nel @@ -395,8 +391,6 @@ messages. If .I nel is zero, the channel is unbuffered. -.IR Chancreate -allocates a new channel and initializes it. .I Chanfree frees a channel that is no longer used. .I Chanfree diff --git a/sys/src/libthread/channel.c b/sys/src/libthread/channel.c index 54bd5373d..4e410aa94 100644 --- a/sys/src/libthread/channel.c +++ b/sys/src/libthread/channel.c @@ -49,21 +49,6 @@ chanfree(Channel *c) 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* chancreate(int elemsize, int elemcnt) { |