avoid function collisions ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Howie

    #1

    avoid function collisions ?

    Hi,

    we have an ActiveX Application with a 3D scene management.

    During calculations in a function (foo1) wich is startet every
    mousemove or mouseclick or by user who is click a button on a
    html-panel, the foo1 ist startet again bevore the old foo1 is ready.
    (event-driven ?).

    I tried to stop another foo1 if an bool (as switch) is false. But then
    i lost the user-button click, so i must stack all user-button clicks
    an give them later on idle time.


    How can i avoid such situation of collision functions ?


    Thanks in advance,

    Howie

  • John Harrison

    #2
    Re: avoid function collisions ?


    "Howie" <howieh@webb.de > wrote in message
    news:4e46kvslpl 15nbcin14d3tpkr c058lrvf7@4ax.c om...[color=blue]
    > Hi,
    >
    > we have an ActiveX Application with a 3D scene management.
    >
    > During calculations in a function (foo1) wich is startet every
    > mousemove or mouseclick or by user who is click a button on a
    > html-panel, the foo1 ist startet again bevore the old foo1 is ready.
    > (event-driven ?).
    >
    > I tried to stop another foo1 if an bool (as switch) is false. But then
    > i lost the user-button click, so i must stack all user-button clicks
    > an give them later on idle time.
    >
    >
    > How can i avoid such situation of collision functions ?
    >[/color]

    You need to use a technique called a critcal section. While one thread is
    inside the critcal section, all other threads will wait until it leaves.
    When it does leave one other thread will be permitted to enter the critcal
    section.

    But standard C++ has no support for crtical sections or any form of
    threading at all (standard C++ is the topic of this newsgroup). You need to
    ask in a Windows programming group, like
    news:comp.os.ms-windows.program mer.win32 or you could just look up critical
    section in MSDN.

    john


    Comment

    • John Harrison

      #3
      Re: avoid function collisions ?

      Critical section

      Apologies for my spelling.

      john



      Comment

      • Rolf Magnus

        #4
        Re: avoid function collisions ?

        Howie wrote:
        [color=blue]
        > Hi,
        >
        > we have an ActiveX Application with a 3D scene management.
        >
        > During calculations in a function (foo1) wich is startet every
        > mousemove or mouseclick or by user who is click a button on a
        > html-panel, the foo1 ist startet again bevore the old foo1 is ready.
        > (event-driven ?).
        >
        > I tried to stop another foo1 if an bool (as switch) is false. But then
        > i lost the user-button click, so i must stack all user-button clicks
        > an give them later on idle time.[/color]

        That's basically what most GUI toolkits do: Each received event is put
        into a queue with a time stamp of when it happened, and in the event
        loop, the queued events are sent to their targets.

        Comment

        • Howie

          #5
          Re: avoid function collisions ?

          Thanks to you

          John and Rolf,

          @Rolf
          Each function with timestamp and a special flag, to drop some
          functions that should not be queued ?


          Thanks,

          Howie

          Comment

          Working...