NAME

gbatch_varmon - monitor changes to the variables list


SYNOPSIS

#include <gbatch.h>

int gbatch_varmon(const int fd, void (*fn)(const int))


DESCRIPTION

Note that this routine is not available in the Windows version, please see <a href="#Xb_setmon_def">the section on gbatch_setmon</a> which covers both jobs and variables.

The function gbatch_varmon is used to set a function to monitor changes to the variables list.

fd is a file descriptor which was previously returned by a successful call to gbatch_open(3).

fn is a pointer to a function which will handle the changes to the list or NULL, which cancels any previous call. This function will be called with fd as an argument when any change is noted. The API does not note which variables the user is interested in, so any changes to variables may provoke a call to this function.


RETURN VALUES

The function returns 0 if successful, otherwise an error code as defined in the include file \fBgbatch.h\fR.


EXAMPLE

 void note_mod(const int fd)
 {
        var_changes++;
 }
 ...
 gbatch_varmon(fd, note_mod);
 if (var_changes)  {
    var_changes = 0;
    ...
    /* Re-read list etc */
    ...
 }
 gbatch_varmon(fd, NULL);


SEE ALSO

gbatch_open(3), gbatch_close(3), gbatch_jobmon(3).


COPYRIGHT

Copyright (c) 2009 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of the GNU General Public License <http://www.gnu.org/licenses/gpl.html>. There is NO WARRANTY, to the extent permitted by law.


AUTHOR

John M Collins, Xi Software Ltd.