Ernest,

Thanks for your description of locks, the part of values and bindings
and "fact-slot-value" references are of interest.

I have 2 cases where rules use the "fact-slot-value" method, and based
upon the original postings multithreaded use case, are these uses thread
safe or could the value of the fact change from the original match to
the access of slot data.

My specific task is to improve the throughput of the application and as
I have inherited these rules from another source, I would also be
curious as to your thoughts on the performance of fact-slot-value vs.
the early binding of all the necessary values in the original rule
pattern. The matching test for the rules may involve as few as 2-4
fields, whereas the "some-function" and access to the fields may be as
many as 10 fields.

Case 1 (fact-slot-value in rhs)
(defrule r1
    ?f1 <-
        (FACT1
           (OP "UPDATE")
            ...
        )
       ...
=>
       ...
   (some-function (fact-slot-value ?f1 S1))
)

Case 2 (fact-slot-value in lhs)
(defrule r1
    ?f1 <-
        (FACT1
            (OP "UPDATE")
            ...
        )
        (exists
            (or
                (test (neq (fact-slot-value ?eqpst S1)
                           (fact-slot-value ?eqpst S2)))
                (test (neq (fact-slot-value ?eqpst S3)
                           (fact-slot-value ?eqpst S4)))
            )
        )    
   ...
=>
   ...
)

Thanks,
Jon Weygandt

-- Original Message --

> If one thread is executing run() (and fires and executes rules) and a 
> second threads does a deffact() or undeffact(), can the facts be
updated 
> while a RHS is executing? 

There is no "deffact()" method, but based on your earlier statements I
think you mean "definstance()". Can facts be updated while a rule is
firing? Yes. Values bound on the LHS are copies from the facts that
activate a rule before the rule fires, so if the fact changes while
the rule is firing, the original bound values are used.


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to