Spinroot

A forum for Spin users

You are not logged in.

#1 2013-06-06 19:30:55

arian
Member
Registered: 2013-06-06
Posts: 7

atomic?

I've recently developed in Spin and I have a question to solve, in my project I have two prototypes and run tolamente need a first or another later.
They function as two finite state machines to represent a client-server architecture for a stop and wait protocol

Offline

#2 2013-06-06 19:37:48

spinroot
forum
Registered: 2010-11-18
Posts: 703
Website

Re: atomic?

you mean two 'proctypes' ? and you want to run one to completion before enabling the other?

Offline

#3 2013-06-06 19:43:33

arian
Member
Registered: 2013-06-06
Posts: 7

Re: atomic?

that's right, two proctypes and I need to run first one then the other

Offline

#4 2013-06-06 19:44:28

spinroot
forum
Registered: 2010-11-18
Posts: 703
Website

Re: atomic?

just send a message from the first to the second process, and have the second process wait for that message

Offline

#5 2013-06-06 19:48:33

arian
Member
Registered: 2013-06-06
Posts: 7

Re: atomic?

when you say "send a message" you mean using data send by the channel?

Offline

#6 2013-06-06 19:49:46

spinroot
forum
Registered: 2010-11-18
Posts: 703
Website

Re: atomic?

mtype = { go };
chan q = [0] of { mtype };

active proctype One() { .....; q!go }
active proctype Two() { q?go; ..... }

Offline

#7 2013-06-06 19:58:48

arian
Member
Registered: 2013-06-06
Posts: 7

Re: atomic?

the run well, correct?
init
    {
      atomic { run controlador(2,1); run agente(2,1) }
         }

Offline

#8 2013-06-06 20:45:21

spinroot
forum
Registered: 2010-11-18
Posts: 703
Website

Re: atomic?

you don't need a run statement if the proctypes are declared 'active'
but if you omit that, then yes, that's how you can start the processes as well

Offline

#9 2013-06-13 14:53:18

arian
Member
Registered: 2013-06-06
Posts: 7

Re: atomic?

the process that initiates the communication is the controller, running all states, and then send to the agent, which analyzes the information received and if all is well, send your answer ... so should sudecer, that's why I need to run around a complete process and then the other, that's where my question lies, I can not run all the prototype and then the other

Offline

Board footer

Powered by FluxBB