Project

General

Profile

VxWorks Concurrency Library

vwpp is a C++ library that wraps the low-level VxWorks IPC primitives into a more useful and safe form. This library relieves the programmer from keeping track of resource management details, instead letting the compiler handle them. This library meets the strong exception guarantee1 and is exception-safe.

To use the library, your source code needs to include vwpp.h. No references from the VxWorks' headers are used, so if this library meets your needs, you don't have to include any VxWorks headers. Your startup script needs to load vwpp.out from the proper BSP and version directory before any module that uses the library is loaded (or, you can link with the static library so nothing has to be pre-loaded.)

The library encapsulates the following primitives:

There are also experimental APIs:

All functions and types are defined in the vwpp namespace.

Usage

The stable library is at version 2.4 and has been built for VxWorks versions 6.4 and 6.7. You may load the VxWorks module by adding the following to your startup script:

ld(1, 1, "vxworks_boot/v#.#/module/BSP/vwpp-2.4.out");

where v#.# is your version of VxWorks (i.e. v6.4, or v6.7). BSP should be replaced by your board support package designation (e.g. mv2401). The library is fairly small and contains many simple, one-line functions so this author typically links his modules with the static library, which removes the necessity of loading the module. Adding ${PRODUCTS_LIBDIR}/libvwpp-2.4.a to the dependency list of the .out target will create a module that doesn't require preloading the vwpp module.

The 6.x C++ compilers report a compile-time error when embedding objects in structures (or other objects) when the -fpack-struct option is used. The front-end group has removed the requirement of -fpack-struct in MOOC and ACNET, so this shouldn't be a problem unless your Makefile adds this option to your project's build.

Many routines in this library specify a time-out parameter given in units of milliseconds. Since the underlying VxWorks primitives use system ticks for their timeout, the actual time delay will be rounded to the next higher tick value.

Tutorials

Here are some pages that describe the design of the library along with examples of how to use it.

Changes in v2.5

v2.5 is available for testing out new features. It is not recommended for use in operational systems since any interfaces not in v2.4 are subject to change before the release. However, I appreciate any feedback, so if you want to try new features, install this on a development machine.

  • Created an exception class, vwpp::timeout_error, which is derived from std::runtime_error. This exception is thrown when a timeout value is given and the operation times out. Previously, code would catch this condition using std::runtime_error. That code will still work. However, using vwpp:timeout_error lets your code distinguish timeout errors from other run-time errors.
  • The vwpp::NoHeap class now prevents the use of placement new operators on classes derived from it.
  • The vwpp::VME::A16 template has been generalized and is now called vwpp::VME::Memory.

1 The strong guarantee is that, if the function fails due to an exception, the program state must not be changed.