9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Sergey Reva <rs_rlab@mail.ru>
To: Fans of the OS Plan 9 from Bell Labs <9fans@cse.psu.edu>
Subject: Re: [9fans] How it work?
Date: Fri, 25 Mar 2005 12:33:43 +0200	[thread overview]
Message-ID: <676328296.20050325123343@mail.ru> (raw)
In-Reply-To: <4439b95e268ad4987f174271ac554f28@smtp.songnetworks.no>

Hello Fans!

Still need help with Rendez...
I can use lock, qlock and rendezvous without any problem but Rendez
don't work... if rsleep executed earlier than rwakeup, abort() cause
exception, stk() show:
rsleep ... /sys/src/libc/9sys/qlock.c:286
This line contain me = getqlp() in getqlp i find abort()...

in other way when rwakeup executed first, abort() ... stk() show:
rwakeup ... /sys/src/libc/9sys/qlock.c:329
which point me to another abort()

Maybe it wrong initialization? But I also try other way... or I wrong
use rendez?

#include <u.h>
#include <libc.h>

QLock q={0};
Rendez r={.l=&q};

void testthread(void)
{
        switch(rfork(RFPROC|RFMEM))
        {
                case -1:
                        print("can't fork");
                        exits(0);
                case 0:
                        break;
                default:
                        return;
        }

        for(;;)
        {
                print("Sleep\n");
                rsleep(&r);
                print("Wake up!\n");
        }

        exits(0);
}

void main(int,char**)
{
        int x;

        testthread();

        for (x=0;x<10;)
        {
                if (rwakeup(&r))
                        x++;
        }
        exits(0);
}

Thanks for help!

--
http://rs-rlab.narod.ru                            mailto:rs_rlab@mail.ru



  parent reply	other threads:[~2005-03-25 10:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22 19:00 Sergey Reva
2005-03-23  0:40 ` Tim Newsham
2005-03-23  6:57   ` Sergey Reva
2005-03-23 17:34     ` Russ Cox
2005-03-24  8:46       ` Sergey Reva
2005-03-24  8:55         ` noselasd
     [not found]         ` <4439b95e268ad4987f174271ac554f28@smtp.songnetworks.no>
2005-03-25 10:33           ` Sergey Reva [this message]
2005-03-25 17:08             ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=676328296.20050325123343@mail.ru \
    --to=rs_rlab@mail.ru \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).