[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

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);


[Back to Amiga Developer Docs]