The Daily Click ::. Forums ::. Klik Coding Help ::. Mutual Exclusion?
 

Post Reply  Post Oekaki 
 

Posted By Message

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
29th January, 2005 at 16:35:18 -

Hi!
I have a problem ragarding the counter object. It seems like when two events updates the counter at the same time, like event1: add 100 to counter, and event2: add 100 counter, the counter only increases the value by 100. And then it is done. After studying this a bit I found out that the "add to counter" operation maybe not is atomic, which means that there is more than one computer operation required to actually add this value to the counter. Maybe it works like this: temp = counter; temp = temp+value; counter = temp; where value is the value you wished to add to the counter and temp is a free register in the processor or the memory. This means that if two of this events occur at times exactly after another, the computer will work like this:

process1: temp1 = counter
process2: temp2 = counter
process1: temp1 = temp1+value
process2: temp2 = temp2+value
process1: counter = temp1
process2: counter = temp2

This means that the only the last added value really will be added.
Is there ANY way around this? Any way to not let processor start to processes of a certain kind in MMF. Or will there be in MMF2?


 
n/a

Kris

Possibly Insane

Registered
  17/05/2002
Points
  2017
29th January, 2005 at 16:47:19 -

Have you got an example gam\cca that shows this happening?

 
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
29th January, 2005 at 16:52:35 -

well, I could make one right now but I have nowhere to put it. But maybe I could email it to you?

 
n/a

RapidFlash

Savior of the Universe

Registered
  14/05/2002
Points
  2712
29th January, 2005 at 17:52:25 -

This doesn't happen to me. Which Clickteam product are you using?

 
http://www.klik-me.com

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
29th January, 2005 at 18:03:12 -

I am using the MMF demo. Maybe they´ve fixed this in an upgrade?

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
29th January, 2005 at 18:52:16 -

If you just have an app:

Start of frame - add to counter 100

Start of frame - add to counter 100

Then the counter's value will be 200 when you run the app. It is most probabley something to do with the demo.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Tigerworks

Klik Legend

Registered
  15/01/2002
Points
  3882
29th January, 2005 at 18:59:17 -

I've never heard of that problem, it's very obscure. MMF does NOT do any kind of multi-processing and keep seperate values for the same thing, if you add to a counter twice, it definitely adds to the counter twice. Maybe one of the events adding to the counter didn't run because one of its conditions was false?

 
- Tigerworks

Dave Matthew (Jester Gaming)



Registered
  09/07/2004
Points
  148
29th January, 2005 at 19:31:46 -

You can take a look at this. http://i.domaindlx.com/syntrocksit/correctcounting(not).cca
When I start the application it tells me I have 34 object or so. but when they then are counted by the red line (download and you´ll understand), I end up with only 30 or 31 objects really counted.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click