aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/proc.c')
-rw-r--r--libgo/runtime/proc.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index dac32eb..02b62be 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -564,7 +564,8 @@ static struct __go_channel_type chan_bool_type_descriptor =
CHANNEL_BOTH_DIR
};
-extern Hchan *__go_new_channel (ChanType *, uintptr);
+extern Hchan *makechan (ChanType *, int64)
+ __asm__ (GOSYM_PREFIX "runtime.makechan");
extern void closechan(Hchan *) __asm__ (GOSYM_PREFIX "runtime.closechan");
static void
@@ -613,7 +614,7 @@ runtime_main(void* dummy __attribute__((unused)))
runtime_throw("runtime_main not on m0");
__go_go(runtime_MHeap_Scavenger, nil);
- runtime_main_init_done = __go_new_channel(&chan_bool_type_descriptor, 0);
+ runtime_main_init_done = makechan(&chan_bool_type_descriptor, 0);
_cgo_notify_runtime_init_done();
@@ -853,6 +854,14 @@ runtime_ready(G *gp)
g->m->locks--;
}
+void goready(G*, int) __asm__ (GOSYM_PREFIX "runtime.goready");
+
+void
+goready(G* gp, int traceskip __attribute__ ((unused)))
+{
+ runtime_ready(gp);
+}
+
int32
runtime_gcprocs(void)
{
@@ -1898,6 +1907,22 @@ runtime_park(bool(*unlockf)(G*, void*), void *lock, const char *reason)
runtime_mcall(park0);
}
+void gopark(FuncVal *, void *, String, byte, int)
+ __asm__ ("runtime.gopark");
+
+void
+gopark(FuncVal *unlockf, void *lock, String reason,
+ byte traceEv __attribute__ ((unused)),
+ int traceskip __attribute__ ((unused)))
+{
+ if(g->atomicstatus != _Grunning)
+ runtime_throw("bad g status");
+ g->m->waitlock = lock;
+ g->m->waitunlockf = unlockf == nil ? nil : (void*)unlockf->fn;
+ g->waitreason = reason;
+ runtime_mcall(park0);
+}
+
static bool
parkunlock(G *gp, void *lock)
{
@@ -1914,6 +1939,21 @@ runtime_parkunlock(Lock *lock, const char *reason)
runtime_park(parkunlock, lock, reason);
}
+void goparkunlock(Lock *, String, byte, int)
+ __asm__ (GOSYM_PREFIX "runtime.goparkunlock");
+
+void
+goparkunlock(Lock *lock, String reason, byte traceEv __attribute__ ((unused)),
+ int traceskip __attribute__ ((unused)))
+{
+ if(g->atomicstatus != _Grunning)
+ runtime_throw("bad g status");
+ g->m->waitlock = lock;
+ g->m->waitunlockf = parkunlock;
+ g->waitreason = reason;
+ runtime_mcall(park0);
+}
+
// runtime_park continuation on g0.
static void
park0(G *gp)