[comp.sys.amiga.programmer] ADCMD_ALLOCATE, ADIOF_NOWAIT => IOERR_ALLOCFAILED ?

zap@indic.se (Jonas Petersson) (02/17/91)

I've just finished an Arexx sound daemon for those without lot's of chipmem
(which might show up here in a while) and during that development I had some 
problems with the Audio device:

No matter what parameters I put in the channel allocation request, the 
program either gets what it wants or hangs around 'til it does. 
ADIOF_NOWAIT, IOF_QUICK, low/illegal values for ln_Pri makes no difference,
I have never got an IOERR_ALLOCFAILED...

The simple solution is ofcourse to allocate no channels as the last 
combination, but I suppose I've missed something. Does someone have an
example that produces an IOERR_ALLOCFAILED?


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)

Seems to work fine - any opinions?


Jonas (My program was on Manx release disks, Yahoo! ;-) Petersson
	-- Absolut Software (Hack for fun) & Indic (Hacking for money)
-- 
     ///  "Are you THE Zaphod Beeblebrox ????" # zap@indic.se
__  ///                                        # Air Quality Surveillance
\\\///    "No, just A Zaphod Beeblebrox.       # "I can feel it coming 
 \///  Didn't you hear - I come in sixpacks !" #   in the air..."

jesup@cbmvax.commodore.com (Randell Jesup) (02/18/91)

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