Re: Viengoos IPC

James Collier <[email protected]>
Newsgroups gmane.os.hurd.l4
Message-ID <1246756098.14930.10.camel@jcollier-work-laptop>
Hello again,
I've continued playing with IPC on Viengoos.
I've think had some success but I'd run up against what feels like a
brick wall now.
I have a child thread sending a message to the parent (main) thread.
I start the child thread with pthread_create, except it apparently never
starts.

Following is the child thread code for sending the IPC:
<code>
void
hello_sender(int argc, char** argv)
{
  if(argc != 1) pthread_exit(NULL);

  vg_addr_t recv_messenger =
	 vg_addr_chop(VG_PTR_TO_ADDR(argv[0]),PAGESIZE_LOG2);
  struct hurd_message_buffer *mb = hurd_message_buffer_alloc();

  s_printf("running second thread.\n");
  vg_send(VG_IPC_RECEIVE_SET_THREAD_TO_CALLER |
          VG_IPC_RECEIVE_SET_ASROOT_TO_CALLERS,
          /*activity*/VG_ADDR_VOID, recv_messenger, mb->sender,
          VG_PTR_TO_PAGE(mb->request));

  hurd_message_buffer_free(mb);
  s_printf("Finished child thread\n");
  pthread_exit(NULL);
}
</code>

I never see "running second thread" printed.
Following is the code for the parent (main) thread:

<code>
int
main (int argc, char *argv[])
{
  activity = __hurd_startup_data->activity;
  s_printf ("Running messenger...\n");
  struct hurd_message_buffer *mb = hurd_message_buffer_alloc();

  pthread_t srvr;
  pthread_create(&srvr, NULL, (void *) &hello_sender,
                 VG_ADDR_TO_PTR(vg_addr_extend(mb->receiver_strong, 0,
			PAGESIZE_LOG2)));


  error_t err;
  err = vg_ipc(VG_IPC_RECEIVE | VG_IPC_RECEIVE_ACTIVATE |
	       VG_IPC_SEND_SET_THREAD_TO_CALLER |
               VG_IPC_SEND_SET_ASROOT_TO_CALLERS,
               VG_ADDR_VOID, 
	       mb->receiver_strong,VG_PTR_TO_PAGE(mb->reply),
               VG_ADDR_VOID, VG_ADDR_VOID,
               VG_ADDR_VOID, VG_ADDR_VOID);
  s_printf("Received message!\n");
  pthread_join(srvr, NULL);
  hurd_message_buffer_free(mb);
  return 0;
}
</code>

I also never see "Received message!" printed.
Thanks for any advice.

James C (jColl)

-- 
James Collier <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.