2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
9 /*****************************************************************************
14 #include <devices/input.h>
15 #include <proto/exec.h>
16 #include <proto/commodities.h>
17 #include <aros/debug.h>
19 VOID
RemoveHandler(struct CommoditiesBase
*CxBase
);
21 AROS_LH1(VOID
, RemoveCxObj
,
25 AROS_LHA(CxObj
*, co
, A0
),
29 struct Library
*, CxBase
, 17, Commodities
)
33 Removes 'co' from the lists it's in. The function handles smoothly the
34 cases when 'co' is NULL or haven't been inserted in a list.
38 co -- the commodity object to remove (may be NULL)
50 AttachCxObj(), EnqueueCxObj(), InsertCxObj()
56 ******************************************************************************/
66 if ((co
->co_Flags
& COF_VALID
) == 0)
71 ObtainSemaphore(&GPB(CxBase
)->cx_SignalSemaphore
);
74 co
->co_Flags
&= ~COF_VALID
;
76 if ((CXOBJType(co
) == CX_BROKER
) || (CXOBJType(co
) == CX_ZERO
))
78 if (IsListEmpty(&GPB(CxBase
)->cx_BrokerList
))
80 RemoveHandler(GPB(CxBase
));
84 /* Tell Exchange what happened */
85 BrokerCommand(NULL
, CXCMD_LIST_CHG
);
89 ReleaseSemaphore(&GPB(CxBase
)->cx_SignalSemaphore
);
95 VOID
RemoveHandler(struct CommoditiesBase
*CxBase
)
97 if (CxBase
->cx_IORequest
.io_Device
== NULL
)
102 CxBase
->cx_InputMP
.mp_SigTask
= FindTask(NULL
);
103 CxBase
->cx_IORequest
.io_Command
= IND_REMHANDLER
;
104 DoIO((struct IORequest
*)&CxBase
->cx_IORequest
);
105 CloseDevice((struct IORequest
*)&CxBase
->cx_IORequest
);
106 CxBase
->cx_IORequest
.io_Device
= NULL
;
107 CxBase
->cx_Running
= FALSE
;