Re: MIDIReadProc and reentrancy
Re: MIDIReadProc and reentrancy
- Subject: Re: MIDIReadProc and reentrancy
- From: Doug Wyatt <email@hidden>
- Date: Tue, 2 Apr 2002 19:06:07 -0800
On Tuesday, April 2, 2002, at 02:14 , Thomas Hudson wrote:
Is MIDIReadProc called by MIDIServer in a single thread per application,
or a thread per port, or thread per connection? Must this read proc be
reentrant, or can I assume only one invocation at a time?
One thread per app, so you can assume it won't be called re-entrantly.
I have a read proc sending midi packets through a raw mach port to be
received in the main thread via an NSMachPort (monitored in the main
thread's NSRunLoop).
I would like to use a prefilled global struct and just set the port
number from connRefCon in the read proc to avoid having to dynamically
allocate a new mach message structure for each read proc call. Of course
this won't if multiple invocations of my read proc are occuring
simultaneously.
Or am I being overly cautious about calling malloc in the read proc?
It's OK to call malloc on a realtime thread as long as you realize that
another lower-priority thread may block you and you won't get to do your
work as soon as you might have wanted.
Doug
--
Doug Wyatt
work: email@hidden (CoreAudio)
personal: email@hidden
http://www.sonosphere.com
"You cannot not communicate."
-- Paul Watzlawick, Pragmatics of Human Communication
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.