avoid function collisions ?

H

Howie

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
 
J

John Harrison

Howie said:
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 ?

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
or you could just look up critical
section in MSDN.

john
 
R

Rolf Magnus

Howie said:
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.

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.
 
H

Howie

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top