Following up on @garlick's similar changes to allow creation of custom watchers outside of reactor.c, these changes slightly modify watcher internals and expose flux_watcher_create and some accessors for the opaque watcher type.

However, I'm not sure if the approach goes too far, or not far enough, or if we should try something else.

The changes are pretty simple, however, highlights are:

The integer per-class signature was dropped because it didn't seem like there was a feasible way to guarantee uniqueness for new and/or custom watchers.

The watcher operations structure was replaced with a pointer to a global per-class flux_watcher_ops structure, since there should just be one global/static operations structure per "class" not per watcher. (If there is a good reason to copy in the ops structure to the watcher, I'm sorry I didn't know it)

The ops pointer can now be used to check for the class of watcher, replacing the previous use case for the watcher signatures.

Accessors were added to return the void *impl implementation data as well as the address of the operations structure

Since there's now an accessor for impl, both the return by reference argument toflux_watcher_create and the explicit void * impl argument to the watcher start,stop,destroy methods were dropped.

Make the 'ops' vtable member of flux_watcher into a pointer to an
watcher_ops structure, instead of copying the vtable into each instance
of the watcher class.
This then obviates the need for watcher "signatures", because the
address of the operations structure can be used to uniquely identify
each "class" of watcher.
Besides, since the signatures were defined inside the source of
reactor.c, there was no way to guarauntee that any externally created
watchers would have a different signature from existing watchers;

There's no need to pass watcher implementation pointer `impl` to the
watcher interface functions. Watchers internally defined in reactor.c
can use w->impl, and externally defined watchers can use the
flux_watcher_impl () accessor.

Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.