The "w" Package

These routines are meant to provide support for work functions. Work functions are similar to threads in that they allow background processing to be done, but require no threading support from the Operating System. Work functions are only executed while the application would otherwise be idle. NOTE: THIS PACKAGE IS WORK IN PROGRESS. THE INTERFACE MAY CHANGE IN THE NEXT RELEASE, POSSIBLY WITHOUT NOTICE.

Library: karma
Link With: -lkarma

Functions

w_test_supportedTest if application supports work functions.
w_register_supportRegister support for work functions.
w_register_notify_funcRegister new work function callback.
w_work_to_be_doneTest for pending work functions waiting to be called.
w_do_workDo some work.
w_register_funcRegister a work function.
w_unregister_funcUnregister a work function.

Prototype Functions

w_PROTO_new_funcNew work function callback.
w_PROTO_work_funcWork function.

Tables

w_PRIORITIESList work function priorities


Functions


flag w_test_supported ()

This routine will determine if work functions have been supported by the application.

Parameters:

Returns: TRUE if work functions are supported, else FALSE.
Multithreading Level: Unsafe


void w_register_support ()

This routine will inform the package that the application will support work functions. This routine may only be called once.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


void w_register_notify_func (void (*func) (void *info), void *info)

This routine will register a routine which is called whenever a new work function is registered.

Parameters:

Returns: A KCallbackFunc object. On failure, the process aborts.
Multithreading Level: Unsafe


flag w_work_to_be_done ()

This routine will determine if there are any pending work functions waiting to be called.

Parameters:

Returns: TRUE if any work functions are pending, else FALSE.
Multithreading Level: Unsafe


flag w_do_work ()

This routine will call any pending work functions. The work function at the top of the list is called once only.

Parameters:

Returns: TRUE if more work is left to be done, else FALSE.
Multithreading Level: Unsafe


KWorkFunc w_register_func (flag (*func) (void **info), void *info, unsigned int priority)

This routine will register a work function. The work function at the top of the list is the one that is always called. Only when the work function at the top of the list is unregistered will the next work function be called.

Parameters:

Returns: A KWorkFunc object. On failure, the process aborts.
Multithreading Level: Unsafe


void w_unregister_func (KWorkFunc wf)

This routine will unregister a work function. The second function in the list will moved to the top of the list. A work function cannot unregister itself in this manner.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


Prototype Functions


void w_PROTO_new_func (void *info)

This routine is called whenever a new work function is registered.

Parameters:

Returns: Nothing.
Multithreading Level: Unsafe


flag w_PROTO_work_func (void **info)

This routine is called to perform some work.

Parameters:

Returns: TRUE if the work function should be called again, else FALSE indicating that the work function is to be unregistered.
Multithreading Level: Unsafe


Tables


w_PRIORITIES

Name Meaning
KWF_PRIORITY_HIGHEST Place function at top of list, any work functions registered while this one is running will be placed second in the list
KWF_PRIORITY_HIGH Place function at top of list, any work functions registered while this one is running will be placed at the top of the list
KWF_PRIORITY_LOWEST Place function at bottom of the list


Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services