From mboxrd@z Thu Jan 1 00:00:00 1970 From: rsc@plan9.bell-labs.com Message-Id: <200006161952.PAA05754@cse.psu.edu> To: 9fans@cse.psu.edu Subject: Re: [9fans] C-program error.. Date: Fri, 16 Jun 2000 15:52:46 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Topicbox-Message-UUID: c1e65f36-eac8-11e9-9e20-41e7f4b1d025 A few problems. The main one is that you sent a 32-byte array and tried to read it into what was pointed at by an uninitialized pointer. Compiling with -w would catch this. The second is that you need to use threadprint instead of print to avoid stack problems. Threadprint is like fprint, so you need to give a file descriptor. The below works for me. Russ #include #include #include #define STACKSIZE (2*2048) void recvit(void *arg) { char *s; Channel *in; /* of char* */ in = arg; s = recvp(in); threadprint(1, "%s\n", s); threadexits(0); } void threadmain(int argc, char *argv[]) { Channel *sch; /* of char* */ sch = chancreate(sizeof(char*), 0); proccreate(recvit, (void *)sch, STACKSIZE); sendp(sch, "hello world"); threadprint(1, "done\n"); threadexitsall(nil); }