Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] Gtk over server

Expand Messages
  • Richard Jones
    ... Does the main thread do any intensive work, busy waiting or looping? Rich. -- Richard Jones Red Hat
    Message 1 of 6 , Jan 7, 2008
    • 0 Attachment
      On Sun, Jan 06, 2008 at 03:53:03PM -0800, konrad.siek wrote:
      > I am completely new to Ocaml, having been introduced to it just recently,
      > at a college course,
      > and I have to admit that I find it a very interesting and pleasant
      > language.
      >
      > My problem concerns an application with a Gtk GUI, which should listen to
      > incoming internet
      > connections on a socket in a background thread. Unfortunately that thread
      > does not work
      > very well, and I experience extreme lags in establishing the server and
      > further communication
      > through the net: It takes at least 20 seconds for the program to even
      > begin listening at the socket,
      > and then whole minutes, before it sends back the response (at which time
      > it sends everything it
      > accumulated rather unexpectedly quick.)

      Does the main thread do any intensive work, busy waiting or looping?

      Rich.

      --
      Richard Jones
      Red Hat
    • konrad.siek
      ... Does the main thread do any intensive work, busy waiting or looping? The main thread does nothing in particular: creates the server thread, then sets up
      Message 2 of 6 , Jan 7, 2008
      • 0 Attachment
        On Sun, Jan 06, 2008 at 03:53:03PM -0800, konrad.siek wrote:
        > I am completely new to Ocaml, having been introduced to it just
        > recently,
        > at a college course,
        > and I have to admit that I find it a very interesting and pleasant
        > language.
        >
        > My problem concerns an application with a Gtk GUI, which should listen
        > to
        > incoming internet
        > connections on a socket in a background thread. Unfortunately that
        > thread
        > does not work
        > very well, and I experience extreme lags in establishing the server and
        > further communication
        > through the net: It takes at least 20 seconds for the program to even
        > begin listening at the socket,
        > and then whole minutes, before it sends back the response (at which time
        > it sends everything it
        > accumulated rather unexpectedly quick.)

        Does the main thread do any intensive work, busy waiting or looping?

        The main thread does nothing in particular: creates the server thread,
        then sets up all the widgets and applies Gtk main. There is no intensive
        work done, as far as I can tell.

        --
        View this message in context: http://www.nabble.com/Gtk-over-server-tp14655921p14671274.html
        Sent from the Ocaml Beginner mailing list archive at Nabble.com.
      • konrad.siek
        I know there must be something completely wrong with what I m doing but I have no idea what. Here s a sample snippet of what I m doing - the background thread
        Message 3 of 6 , Jan 8, 2008
        • 0 Attachment
          I know there must be something completely wrong with what I'm doing but I
          have no idea what.
          Here's a sample snippet of what I'm doing -
          the background thread has enormous lags even with a simple print.
          If anyone where to look at it I'd be grateful.

          (*ocamlc -c -thread -dtypes -g -I +lablgtk2 main.ml*)
          (*ocamlc
          unix.cma threads.cma -thread -custom
          -I +lablgtk2 -g lablgtk.cma gtkInit.cmo gtkThread.cmo str.cma
          default_server.cmo main.cmo*)

          let gui () =
          let window = GWindow.window () in
          window#show ();;

          let c = ref 0;;

          let bg () =
          while true do
          print_endline ("HELLO ["^(string_of_int !c)^"]");
          flush_all ();
          c:=!c+1;
          Thread.delay 1.;
          done;;

          let t = Thread.create bg ();;

          gui ();;
          GMain.Main.main ();;
          --
          View this message in context: http://www.nabble.com/Gtk-over-server-tp14655921p14687716.html
          Sent from the Ocaml Beginner mailing list archive at Nabble.com.
        • Richard Jones
          You ll probably want to take this over to the lablgtk mailing list. Rich. -- Richard Jones Red Hat
          Message 4 of 6 , Jan 8, 2008
          • 0 Attachment
            You'll probably want to take this over to the lablgtk mailing list.

            Rich.

            --
            Richard Jones
            Red Hat
          • konrad.siek
            Oh, so I shall. I didn t notice it before. Thank you very much. -- View this message in context: http://www.nabble.com/Gtk-over-server-tp14655921p14698883.html
            Message 5 of 6 , Jan 8, 2008
            • 0 Attachment
              Oh, so I shall. I didn't notice it before. Thank you very much.


              --
              View this message in context: http://www.nabble.com/Gtk-over-server-tp14655921p14698883.html
              Sent from the Ocaml Beginner mailing list archive at Nabble.com.
            Your message has been successfully submitted and would be delivered to recipients shortly.