Spark! Fuzzy Logic Editor Help


Variables | Sets | Rules | API | Integration | Tutorial


wait()

Check the status of a notification event.

int wait(void* event, long milliseconds)

Parameters

void* event The event to wait on.  This is obtained from SparkModel::get_var_notification()
long milliseconds How long to wait for a signal.  If the value is negative we wait forever.  If this value is 0 it checks and returns immediately.

Return Value

1 if event is signaled, 0 if not.

Remarks

This is a utility function that's just provided to help make life simpler.  

See also get_var_notification()

FAQ

Q: How is this different from the Win32 WaitForSingleObject() function?
A: It's only different in the values it returns.  This function is used to abstract any dependencies on the Win32 platform to help ensure future portability.

Example


#include <iostream.h>
#include "SparkModel.h"

        // get values
    while (1)
        {
        if (model.wait(enemy_dist_event, 0))
            {
            cout << "Enemy distance value changed. ";
            cout << "Current value is: ";
            cout << model.get_value(ENEMY_DISTANCE) << endl;
            }

        } // end forever loop

    return 0;

} // end main()