Environment awareness

38 views
Skip to first unread message

Andy

unread,
May 9, 2013, 5:47:12 PM5/9/13
to clip...@googlegroups.com
We started using CLIPS in our application several years ago and never had a need for more than one environment.  We are expanding our use of CLIPS to support new functionality.  That new functionality has a need to use a separate CLIPS environment so is planning on using environment aware functions.
 
Now for my question... Once we start using the idea of multiple environments, do we need to change our original code to use environment aware function calls (vs. the "default" environment we have been using)?  I am getting the impression that the answer to my question is going to be yes (after reading Section 9 - Environments in the Advanced Programming Guide.  I just want to confirm this before spending time and effort on converting the existing function calls so that they are environment aware...
 
Thanks!
 

CLIPS Support

unread,
May 15, 2013, 4:30:37 PM5/15/13
to clip...@googlegroups.com
If you only have one thread of execution at any given time (i.e. multiple environments but just one being executed at any given time), then you do not need to use the environment API. If you're going to have multiple threads running with each thread having its own environment, then you need to use the environment API. For multi-threaded applications, you want to have the ALLOW_ENVIRONMENT_GLOBALS flag in setup.h set to 0. This removes the only global variable used by CLIPS for keeping track of the current environment for single threaded apps.
Reply all
Reply to author
Forward
0 new messages