aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/chanprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libthread/chanprint.c')
-rw-r--r--src/libthread/chanprint.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libthread/chanprint.c b/src/libthread/chanprint.c
new file mode 100644
index 00000000..af9e8103
--- /dev/null
+++ b/src/libthread/chanprint.c
@@ -0,0 +1,18 @@
+#include "threadimpl.h"
+
+int
+chanprint(Channel *c, char *fmt, ...)
+{
+ va_list arg;
+ char *p;
+ int n;
+
+ va_start(arg, fmt);
+ p = vsmprint(fmt, arg);
+ va_end(arg);
+ if(p == nil)
+ sysfatal("vsmprint failed: %r");
+ n = sendp(c, p);
+ yield(); /* let recipient handle message immediately */
+ return n;
+}