diff options
| author | Kai Backman <kaib@golang.org> | 2010-02-18 23:33:21 -0800 |
|---|---|---|
| committer | Kai Backman <kaib@golang.org> | 2010-02-18 23:33:21 -0800 |
| commit | da5d64eed76ca39a8024162b4b449a4485d4769b (patch) | |
| tree | dc1145fe98dd33013d009c048499a7dad7162b1f /src/pkg/runtime/tiny/thread.c | |
| parent | 26e036cd78c7bdd53c79b94ce3a13cf15f447c32 (diff) | |
| download | golang-da5d64eed76ca39a8024162b4b449a4485d4769b.tar.gz | |
combined pchw and embedded into tiny. added section on arm to README
R=rsc
CC=golang-dev
http://codereview.appspot.com/194151
Committer: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/pkg/runtime/tiny/thread.c')
| -rw-r--r-- | src/pkg/runtime/tiny/thread.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/pkg/runtime/tiny/thread.c b/src/pkg/runtime/tiny/thread.c new file mode 100644 index 000000000..e3e8a34b6 --- /dev/null +++ b/src/pkg/runtime/tiny/thread.c @@ -0,0 +1,80 @@ +// Copyright 2010 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#include "runtime.h" + +int8 *goos = "tiny"; + +void +minit(void) +{ +} + +void +osinit(void) +{ +} + +void +initsig(void) +{ +} + +void +exit(int32) +{ + for(;;); +} + +// single processor, no interrupts, +// so no need for real concurrency or atomicity + +void +newosproc(M *m, G *g, void *stk, void (*fn)(void)) +{ + USED(m, g, stk, fn); + throw("newosproc"); +} + +void +lock(Lock *l) +{ + if(m->locks < 0) + throw("lock count"); + m->locks++; + if(l->key != 0) + throw("deadlock"); + l->key = 1; +} + +void +unlock(Lock *l) +{ + m->locks--; + if(m->locks < 0) + throw("lock count"); + if(l->key != 1) + throw("unlock of unlocked lock"); + l->key = 0; +} + +void +noteclear(Note *n) +{ + n->lock.key = 0; +} + +void +notewakeup(Note *n) +{ + n->lock.key = 1; +} + +void +notesleep(Note *n) +{ + if(n->lock.key != 1) + throw("notesleep"); +} + |
