diff options
author | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-12-17 04:34:52 +0000 |
commit | 49588d5d9089589ccda28c41aae90c29d6f72787 (patch) | |
tree | 48cbc911e34b71977b7b98b4d0b94b27d4454081 /src/libthread | |
parent | 7f11104a5737adf261d10bc1a7b85e740f2eb491 (diff) | |
download | plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.gz plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.tar.bz2 plan9port-49588d5d9089589ccda28c41aae90c29d6f72787.zip |
Tweaks to various bits.
Until I hear otherwise, Refs aren't used enough to
merit their own assembly. They are now implemented with locks.
Diffstat (limited to 'src/libthread')
-rw-r--r-- | src/libthread/asm-FreeBSD-386.s | 34 | ||||
-rw-r--r-- | src/libthread/exec-unix.c | 1 | ||||
-rw-r--r-- | src/libthread/ref.c | 11 |
3 files changed, 27 insertions, 19 deletions
diff --git a/src/libthread/asm-FreeBSD-386.s b/src/libthread/asm-FreeBSD-386.s index 074556f9..35e2ab6f 100644 --- a/src/libthread/asm-FreeBSD-386.s +++ b/src/libthread/asm-FreeBSD-386.s @@ -30,20 +30,20 @@ _gotolabel: ret -.globl _xinc -_xinc: - movl 4(%esp), %eax - lock incl 0(%eax) - ret - -.globl _xdec -_xdec: - movl 4(%esp), %eax - lock decl 0(%eax) - jz iszero - movl $1, %eax - ret -iszero: - movl $0, %eax - ret - +# .globl _xinc +# _xinc: +# movl 4(%esp), %eax +# lock incl 0(%eax) +# ret +# +# .globl _xdec +# _xdec: +# movl 4(%esp), %eax +# lock decl 0(%eax) +# jz iszero +# movl $1, %eax +# ret +# iszero: +# movl $0, %eax +# ret +# diff --git a/src/libthread/exec-unix.c b/src/libthread/exec-unix.c index 97c75607..c04d414c 100644 --- a/src/libthread/exec-unix.c +++ b/src/libthread/exec-unix.c @@ -122,6 +122,7 @@ efork(void *ve) for(i=3; i<40; i++) if(i != e->fd[1]) close(i); + rfork(RFNOTEG); execvp(e->prog, e->args); _threaddebug(DBGEXEC, "_schedexec failed: %r"); rerrstr(buf, sizeof buf); diff --git a/src/libthread/ref.c b/src/libthread/ref.c index 9b78e63e..8f50fd5f 100644 --- a/src/libthread/ref.c +++ b/src/libthread/ref.c @@ -3,11 +3,18 @@ void incref(Ref *r) { - _xinc(&r->ref); + lock(&r->lk); + r->ref++; + unlock(&r->lk); } long decref(Ref *r) { - return _xdec(&r->ref); + long n; + + lock(&r->lk); + n = --r->ref; + unlock(&r->lk); + return n; } |