Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!samsung!uunet!cbmvax!jesup From: jesup@cbmvax.commodore.com (Randell Jesup) Newsgroups: comp.sys.amiga.programmer Subject: Re: ADCMD_ALLOCATE, ADIOF_NOWAIT => IOERR_ALLOCFAILED ? Keywords: Audio channel allocation, PeekMsg() Message-ID: <19056@cbmvax.commodore.com> Date: 18 Feb 91 01:59:32 GMT References: <1991Feb16.201228.524@indic.se> Reply-To: jesup@cbmvax.commodore.com (Randell Jesup) Organization: Commodore, West Chester, PA Lines: 29 In article <1991Feb16.201228.524@indic.se> zap@indic.se (Jonas Petersson) writes: >Second question: Which is the "most civilized" way to check whether a msg >is waiting at a port or not? I currently use: > >#define WaitingMsg(port) (port->mp_MsgList.lh_Head->ln_Type==NT_MESSAGE) From the Blue RKMs (slightly modified): #define NOT_EMPTY(list) ((list)->lh_TailPred != (list)) or #define NOT_EMPTY (NULL != (list)->lh_Head->ln_Succ) and #define WaitingPort(port) (NOT_EMPTY(&(port->mp_MsgList)) The NOT_EMPTY macros work for any exec list, and with them WaitingPort becomes trivial. (I reversed the tests from the RKMs to test for not empty instead of empty.) -- Randell Jesup, Keeper of AmigaDos, Commodore Engineering. {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.commodore.com BIX: rjesup The compiler runs Like a swift-flowing river I wait in silence. (From "The Zen of Programming") ;-)