CGI Session Synchronization

Discussion in 'Ruby' started by Patrick Li, Aug 15, 2008.

  1. Patrick Li

    Patrick Li Guest

    I finally tracked down a bug that's been bothering me, and I'm at a
    complete loss for how to fix it. If you have wisdom, please share. =)

    I'm opening a CGI Session using Session.new and storing in $SESSION.

    Unfortunately, my webpage has multiple windows open at a time, each of
    which runs in it's own ruby VM, and accesses it's own $SESSION.

    Is there a way I can synchronize my $SESSION variable?
    eg. Wait for the current Session to be closed before opening it again?

    eg.
    In one window I'm running <Temp.rb>
    which does:

    $SESSION = CGI::Session.new
    #bla #bla #bla
    $SESSION.close

    and in another window I'm running <Temp2.rb>
    which does :

    $SESSION = CGI::Session.new <--- I want this line to stall until
    Temp.rb is done
    #bla bla bla
    $SESSION.close

    Thank you very very much for your help.
    -Patrick
    --
    Posted via http://www.ruby-forum.com/.
    Patrick Li, Aug 15, 2008
    #1
    1. Advertising

  2. Patrick Li

    Emmanuel Oga Guest

    > In one window I'm running <Temp.rb>
    ...
    > and in another window I'm running <Temp2.rb>

    ...

    Patrick: I'm not familiar with handling CGI::Session directly at the
    moment, but if you have multiple ruby processes that you need to
    synchronize I'm sure you will need some form of, well... Interprocess
    communication. You could even use a shared file to somehow synchronize
    the work of the two processes, but maybe the best option would be to
    investigate ruby standard Drb library :
    http://chadfowler.com/ruby/drb.html

    greets
    --
    Posted via http://www.ruby-forum.com/.
    Emmanuel Oga, Aug 16, 2008
    #2
    1. Advertising

  3. Patrick Li

    Patrick Li Guest

    Thanks for the help. It seems to be exactly what I need. I'm gonna need
    to do a little research concerning distributed ruby.
    -Patrick
    --
    Posted via http://www.ruby-forum.com/.
    Patrick Li, Aug 16, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ittay Freiman

    synchronization in session bean

    Ittay Freiman, Jul 12, 2003, in forum: Java
    Replies:
    0
    Views:
    597
    Ittay Freiman
    Jul 12, 2003
  2. Saad Malik

    session and synchronization

    Saad Malik, Jul 4, 2004, in forum: Java
    Replies:
    3
    Views:
    4,297
    VisionSet
    Jul 4, 2004
  3. TonyV
    Replies:
    19
    Views:
    735
    Mark Clements
    Mar 19, 2007
  4. Kevin

    my $session = new CGI::Session()

    Kevin, Mar 22, 2007, in forum: Perl Misc
    Replies:
    3
    Views:
    197
    Jamie
    Mar 27, 2007
  5. Replies:
    0
    Views:
    158
Loading...

Share This Page