Shutting down a commodity is easy. After replying to all cxmessages waiting at the broker's message port, a commodity can delete its cxobjects. the deletecxobj() function removes a single cxobject from the Commodities network. deletecxobjall() removes multiple objects. void DeleteCxObj( CxObj *co ); void DeleteCxObjAll( CxObj *delete_co ); If a commodity has a lot of cxobjects, deleting each individually can be a bit tedious. deletecxobjall() will delete a cxobject and any other CxObjects that are attached to it. The hotkey.c example given later in this chapter uses this function to delete all its CxObjects. A commodity that uses DeleteCxObjAll() to delete all its CxObjects should make sure that they are all connected to the main one. (See the section "connecting cxobjects" below.) After deleting its cxobjects, a commodity must take care of any cxmessages that might have arrived at the message port just before the commodity deleted its objects. while(msg = (CxMsg *)GetMsg(broker_mp)) ReplyMsg((struct Message *)msg);