Global Variable help

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Global Variable help

  • Creator
    Topic
  • #48755
    Ray Mullen
    Participant

      Hi I have the following scenario:

      Thread_A receives sets of messages in a specific order or set.

      Thread_A has an inbound TCL proc, and based on the messages types received creates multiple messages and forwards them to thread_B.

      I am using global variables and when i receive for example an EOLT message these variables are reset. One example of a global variable I use is a message line number which the receiving application needs. The problem I have is when the thread is stopped the messages counter will be lost and the receiving application wont be able to handle this.

      The program also has a many to one relationship in where on certain message sets , buffers info in global variables and when it hits an EOLT message forwards on one message to the receiving application.

      Does anyone have any suggestions how to handle this if the thread is stopped in the middle of message sets e.t.c. or the process panics e.t.c.

      The answer is prob check for first message type in a set and if it exists set a global flag and thereafter if that flag is blank when another message type comes in, I know this is a problem and list the rest of the set to a file and take action.

      Just looking for some ideas and hope this all makes sense.

      Thanks in advance

      Ray

    Viewing 4 reply threads
    • Author
      Replies
      • #59578
        David Harrison
        Participant

          Ray,

          The only thing I can suggest is to manage the variables outside of the Cloverleaf environment. The simplest way is to use files but there may be performance considerations. Or you could use the GBDM database that comes with Cloverleaf.

          Dave

        • #59579
          Charlie Bursell
          Participant

            We do this sort of thing all of the time.

            First, use the built in counter commands to maintain the counter.

            Then for the one to many, just make sure you do not dispose of the IB message until all messages are built.  Maintain the new messages in a global buffer and when all are built, forward them on and, at that time, dispose of the original.

            This way, if the thread stops before you finish, upon startup, it will be delivered to the same proc again and start all over.

            I hope this makes sense

          • #59580
            Ray Mullen
            Participant

              Hi Dave and Charlie

              Thanks for your replies.

              I think I know what you mean Charlie on the one to many scenario,   Build up a disp list of messages and when i reach an eolt release the lot and if the thread is stopped it will start over.

              Charlie one of the main problems I have is the many to many messages coming in.

              e.g a set of messages come in and based on whats in them, the proc creates many messages and forwards them on.

              e.g a set of 5 messages could create 10 messages with line numbers 1 to 10 indicating each msg number for receiving application.

              Then when it reaches an eolt message or the start of new set of messages I initialize the counter back to zero. I could build up a another disp list and when i hit an eolt release them.

              But will i not still lose my counter?

              What are the built in counter commands? Will this solve the problem.

              Thanks in advance Charlie

            • #59581
              Charlie Bursell
              Participant

                These are file based counters which persist even when the engine is not running.

                CtrCurrentValue   CtrInitCounter   CtrNextValue     CtrResetValue

                Just do a help on them from a tcl/hcitcl prompt

              • #59582
                Ray Mullen
                Participant

                  Thanks Charlie ,

                  Really Appreciate it

                  Ray

              Viewing 4 reply threads
              • The forum ‘Cloverleaf’ is closed to new topics and replies.