12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024 |
- {
- File: CarbonCore/Multiprocessing.h
-
- Contains: Multiprocessing interfaces
- The contents of this header file are deprecated.
-
- Copyright: © 1995-2011 DayStar Digital, Inc.
- }
- {
- Modified for use with Free Pascal
- Version 308
- Please report any bugs to <[email protected]>
- }
- {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
- {$mode macpas}
- {$modeswitch cblocks}
- {$packenum 1}
- {$macro on}
- {$inline on}
- {$calling mwpascal}
- {$IFNDEF FPC_DOTTEDUNITS}
- unit Multiprocessing;
- {$ENDIF FPC_DOTTEDUNITS}
- interface
- {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
- {$setc GAP_INTERFACES_VERSION := $0308}
- {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
- {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
- {$endc}
- {$ifc defined CPUPOWERPC and defined CPUI386}
- {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
- {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
- {$endc}
- {$ifc not defined __ppc__ and defined CPUPOWERPC32}
- {$setc __ppc__ := 1}
- {$elsec}
- {$setc __ppc__ := 0}
- {$endc}
- {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
- {$setc __ppc64__ := 1}
- {$elsec}
- {$setc __ppc64__ := 0}
- {$endc}
- {$ifc not defined __i386__ and defined CPUI386}
- {$setc __i386__ := 1}
- {$elsec}
- {$setc __i386__ := 0}
- {$endc}
- {$ifc not defined __x86_64__ and defined CPUX86_64}
- {$setc __x86_64__ := 1}
- {$elsec}
- {$setc __x86_64__ := 0}
- {$endc}
- {$ifc not defined __arm__ and defined CPUARM}
- {$setc __arm__ := 1}
- {$elsec}
- {$setc __arm__ := 0}
- {$endc}
- {$ifc not defined __arm64__ and defined CPUAARCH64}
- {$setc __arm64__ := 1}
- {$elsec}
- {$setc __arm64__ := 0}
- {$endc}
- {$ifc defined cpu64}
- {$setc __LP64__ := 1}
- {$elsec}
- {$setc __LP64__ := 0}
- {$endc}
- {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
- {$error Conflicting definitions for __ppc__ and __i386__}
- {$endc}
- {$ifc defined __ppc__ and __ppc__}
- {$setc TARGET_CPU_PPC := TRUE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __ppc64__ and __ppc64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := TRUE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __i386__ and __i386__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := TRUE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$ifc defined iphonesim}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$endc}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __x86_64__ and __x86_64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := TRUE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$ifc defined iphonesim}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$endc}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$elifc defined __arm__ and __arm__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := TRUE}
- {$setc TARGET_CPU_ARM64 := FALSE}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$setc TARGET_OS_EMBEDDED := TRUE}
- {$elifc defined __arm64__ and __arm64__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_PPC64 := FALSE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$setc TARGET_CPU_X86_64 := FALSE}
- {$setc TARGET_CPU_ARM := FALSE}
- {$setc TARGET_CPU_ARM64 := TRUE}
- {$ifc defined ios}
- {$setc TARGET_OS_MAC := FALSE}
- {$setc TARGET_OS_IPHONE := TRUE}
- {$setc TARGET_OS_EMBEDDED := TRUE}
- {$elsec}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_IPHONE := FALSE}
- {$setc TARGET_OS_EMBEDDED := FALSE}
- {$endc}
- {$setc TARGET_IPHONE_SIMULATOR := FALSE}
- {$elsec}
- {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
- {$endc}
- {$ifc defined __LP64__ and __LP64__ }
- {$setc TARGET_CPU_64 := TRUE}
- {$elsec}
- {$setc TARGET_CPU_64 := FALSE}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := TRUE}
- {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
- {$elifc defined FPC_LITTLE_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := FALSE}
- {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
- {$elsec}
- {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
- {$endc}
- {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
- {$setc CALL_NOT_IN_CARBON := FALSE}
- {$setc OLDROUTINENAMES := FALSE}
- {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
- {$setc OPAQUE_UPP_TYPES := TRUE}
- {$setc OTCARBONAPPLICATION := TRUE}
- {$setc OTKERNEL := FALSE}
- {$setc PM_USE_SESSION_APIS := TRUE}
- {$setc TARGET_API_MAC_CARBON := TRUE}
- {$setc TARGET_API_MAC_OS8 := FALSE}
- {$setc TARGET_API_MAC_OSX := TRUE}
- {$setc TARGET_CARBON := TRUE}
- {$setc TARGET_CPU_68K := FALSE}
- {$setc TARGET_CPU_MIPS := FALSE}
- {$setc TARGET_CPU_SPARC := FALSE}
- {$setc TARGET_OS_UNIX := FALSE}
- {$setc TARGET_OS_WIN32 := FALSE}
- {$setc TARGET_RT_MAC_68881 := FALSE}
- {$setc TARGET_RT_MAC_CFM := FALSE}
- {$setc TARGET_RT_MAC_MACHO := TRUE}
- {$setc TYPED_FUNCTION_POINTERS := TRUE}
- {$setc TYPE_BOOL := FALSE}
- {$setc TYPE_EXTENDED := FALSE}
- {$setc TYPE_LONGLONG := TRUE}
- {$IFDEF FPC_DOTTEDUNITS}
- uses MacOsApi.MacTypes;
- {$ELSE FPC_DOTTEDUNITS}
- uses MacTypes;
- {$ENDIF FPC_DOTTEDUNITS}
- {$endc} {not MACOSALLINCLUDE}
- {$ifc TARGET_OS_MAC}
- {********************************************************************************************
-
- The Multiprocessing Utilities are deprecated. Callers should use blocks, libDispatch, or pthreads.
-
- ********************************************************************************************}
- {
- ===========================================================================================
- *** WARNING: You must properly check the availability of MP services before calling them!
- See the section titled "Checking API Availability".
- ===========================================================================================
- }
- {$ALIGN POWER}
- {
- ======================================= NOTICE ============================================
- As of Mac OS X v10.6, the APIs in this header file are discouraged. These APIs are slated
- for deprecation in the next major release of OS X. The new dispatch APIs (see dispatch(3))
- replace the Multiprocessing APIs and the pthread threading APIs.
- ===========================================================================================
- }
- {
- ===========================================================================================
- This is the header file for version 2.2 of the Mac OS multiprocessing support. This version
- has been totally reimplemented and has significant new services. The main goal of the
- reimplementation has been to transfer task management into the core operating system to provide
- much more reliable and more efficient operation, including on single processor machines.
- The memory management has also been massively improved, it is much faster and wastes much
- less space. New services include POSIX style per-task storage, timers with millisecond and
- microsecond resolutions, memory allocation at a specified alignment, and system pageable
- and RAM resident memory pools. See the MP API documentation for details.
- The old "DayStar" debugging services (whose names began with an underscore) have been
- removed from this header. A very few are still implemented for binary compatibility, or in
- cases where they happened to be exposed inappropriately. (E.g. _MPIsFullyInitialized must
- be called to see if the MP API is ReallyTrulyª usable.) New code and recompiles of old
- code should avoid use of these defunct services, except for _MPIsFullyInitialized.
- ===========================================================================================
- }
- {
- ===========================================================================================
- The following services are from the original MP API and remain supported in version 2.0:
- MPProcessors
- MPCreateTask
- MPTerminateTask
- MPCurrentTaskID
- MPYield
- MPExit
- MPCreateQueue
- MPDeleteQueue
- MPNotifyQueue
- MPWaitOnQueue
- MPCreateSemaphore
- MPCreateBinarySemaphore (In C only, a macro that calls MPCreateSemaphore.)
- MPDeleteSemaphore
- MPSignalSemaphore
- MPWaitOnSemaphore
- MPCreateCriticalRegion
- MPDeleteCriticalRegion
- MPEnterCriticalRegion
- MPExitCriticalRegion
- MPAllocate (Deprecated, use MPAllocateAligned for new builds.)
- MPFree
- MPBlockCopy
- MPLibraryIsLoaded (In C only, a macro.)
- _MPIsFullyInitialized (See comments about checking for MP API availability.)
- ===========================================================================================
- }
- {
- ===========================================================================================
- The following services are new in version 2.0:
- MPProcessorsScheduled
- MPSetTaskWeight
- MPTaskIsPreemptive
- MPAllocateTaskStorageIndex
- MPDeallocateTaskStorageIndex
- MPSetTaskStorageValue
- MPGetTaskStorageValue
- MPSetQueueReserve
- MPCreateEvent
- MPDeleteEvent
- MPSetEvent
- MPWaitForEvent
- UpTime
- DurationToAbsolute
- AbsoluteToDuration
- MPDelayUntil
- MPCreateTimer
- MPDeleteTimer
- MPSetTimerNotify
- MPArmTimer
- MPCancelTimer
- MPSetExceptionHandler
- MPThrowException
- MPDisposeTaskException
- MPExtractTaskState
- MPSetTaskState
- MPRegisterDebugger
- MPUnregisterDebugger
- MPAllocateAligned (Preferred over MPAllocate.)
- MPGetAllocatedBlockSize
- MPBlockClear
- MPDataToCode
- MPRemoteCall (Preferred over _MPRPC.)
- ===========================================================================================
- }
- {
- ===========================================================================================
- The following services are new in version 2.1:
- MPCreateNotification
- MPDeleteNotification
- MPModifyNotification
- MPCauseNotification
- MPGetNextTaskID
- MPGetNextCpuID
- ===========================================================================================
- }
- {
- ===========================================================================================
- The following services are "unofficial" extensions to the original API. They are not in
- the multiprocessing API documentation, but were in previous versions of this header. They
- remain supported in version 2.0. They may not be supported in other environments.
- _MPRPC (Deprecated, use MPRemoteCall for new builds.)
- _MPAllocateSys (Deprecated, use MPAllocateAligned for new builds.)
- _MPTaskIsToolboxSafe
- _MPLibraryVersion
- _MPLibraryIsCompatible
- ===========================================================================================
- }
- {
- ===========================================================================================
- The following services were in previous versions of this header for "debugging only" use.
- They are NOT implemented in version 2.0. For old builds they can be accessed by defining
- the symbol MPIncludeDefunctServices to have a nonzero value.
- _MPInitializePrintf
- _MPPrintf
- _MPDebugStr
- _MPStatusPString
- _MPStatusCString
- ===========================================================================================
- }
- {
- ¤
- ===========================================================================================
- General Types and Constants
- ===========================
- }
- const
- MPCopyrightNotice = 'Copyright © 1995-2000 Apple Computer, Inc.';
- const
- MPLibraryName = 'MPLibrary';
- MPLibraryCName = MPLibraryName;
- MPLibraryPName = MPLibraryName;
- const
- MP_API_Version = '2.3';
- const
- MPLibrary_MajorVersion = 2; { ! When these change be sure to update the build versions}
- MPLibrary_MinorVersion = 3; { ! used in the startup check in MPInitializeAPI!}
- MPLibrary_Release = 1;
- MPLibrary_DevelopmentRevision = 1;
- type
- MPProcessID = ^OpaqueMPProcessID; { an opaque type }
- OpaqueMPProcessID = record end;
- MPProcessIDPtr = ^MPProcessID;
- MPTaskID = ^OpaqueMPTaskID; { an opaque type }
- OpaqueMPTaskID = record end;
- MPTaskIDPtr = ^MPTaskID;
- MPQueueID = ^OpaqueMPQueueID; { an opaque type }
- OpaqueMPQueueID = record end;
- MPQueueIDPtr = ^MPQueueID;
- MPSemaphoreID = ^OpaqueMPSemaphoreID; { an opaque type }
- OpaqueMPSemaphoreID = record end;
- MPSemaphoreIDPtr = ^MPSemaphoreID;
- MPCriticalRegionID = ^OpaqueMPCriticalRegionID; { an opaque type }
- OpaqueMPCriticalRegionID = record end;
- MPCriticalRegionIDPtr = ^MPCriticalRegionID;
- MPTimerID = ^OpaqueMPTimerID; { an opaque type }
- OpaqueMPTimerID = record end;
- MPTimerIDPtr = ^MPTimerID;
- MPEventID = ^OpaqueMPEventID; { an opaque type }
- OpaqueMPEventID = record end;
- MPEventIDPtr = ^MPEventID;
- MPAddressSpaceID = ^OpaqueMPAddressSpaceID; { an opaque type }
- OpaqueMPAddressSpaceID = record end;
- MPAddressSpaceIDPtr = ^MPAddressSpaceID;
- MPNotificationID = ^OpaqueMPNotificationID; { an opaque type }
- OpaqueMPNotificationID = record end;
- MPNotificationIDPtr = ^MPNotificationID;
- MPCoherenceID = ^OpaqueMPCoherenceID; { an opaque type }
- OpaqueMPCoherenceID = record end;
- MPCoherenceIDPtr = ^MPCoherenceID;
- MPCpuID = ^OpaqueMPCpuID; { an opaque type }
- OpaqueMPCpuID = record end;
- MPCpuIDPtr = ^MPCpuID;
- MPAreaID = ^OpaqueMPAreaID; { an opaque type }
- OpaqueMPAreaID = record end;
- MPAreaIDPtr = ^MPAreaID;
- MPConsoleID = ^OpaqueMPConsoleID; { an opaque type }
- OpaqueMPConsoleID = record end;
- MPConsoleIDPtr = ^MPConsoleID;
- MPOpaqueID = ^OpaqueMPOpaqueID; { an opaque type }
- OpaqueMPOpaqueID = record end;
- MPOpaqueIDPtr = ^MPOpaqueID;
- const
- { Values for MPOpaqueIDClass.}
- kOpaqueAnyID = 0;
- kOpaqueProcessID = 1;
- kOpaqueTaskID = 2;
- kOpaqueTimerID = 3;
- kOpaqueQueueID = 4;
- kOpaqueSemaphoreID = 5;
- kOpaqueCriticalRegionID = 6;
- kOpaqueCpuID = 7;
- kOpaqueAddressSpaceID = 8;
- kOpaqueEventID = 9;
- kOpaqueCoherenceID = 10;
- kOpaqueAreaID = 11;
- kOpaqueNotificationID = 12;
- kOpaqueConsoleID = 13;
- type
- MPOpaqueIDClass = UInt32;
- const
- kMPNoID = kInvalidID; { New code should use kInvalidID everywhere.}
- type
- MPTaskOptions = OptionBits;
- MPTaskOptionsPtr = ^MPTaskOptions;
- TaskStorageIndex = ItemCount;
- TaskStorageIndexPtr = ^TaskStorageIndex;
- TaskStorageValue = LogicalAddress;
- TaskStorageValuePtr = ^TaskStorageValue;
- MPSemaphoreCount = ItemCount;
- MPSemaphoreCountPtr = ^MPSemaphoreCount;
- MPTaskWeight = UInt32;
- MPTaskWeightPtr = ^MPTaskWeight;
- MPEventFlags = UInt32;
- MPEventFlagsPtr = ^MPEventFlags;
- MPExceptionKind = UInt32;
- MPExceptionKindPtr = ^MPExceptionKind;
- MPTaskStateKind = UInt32;
- MPTaskStateKindPtr = ^MPTaskStateKind;
- MPPageSizeClass = UInt32;
- MPPageSizeClassPtr = ^MPPageSizeClass;
- const
- kDurationImmediate = 0;
- kDurationForever = $7FFFFFFF;
- kDurationMillisecond = 1;
- kDurationMicrosecond = -1;
- {
- ¤
- ===========================================================================================
- Process/Processor Services
- ==========================
- }
- {
- * MPProcessors() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Not thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPProcessors: ItemCount; external name '_MPProcessors';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { The physical total.}
- {
- * MPProcessorsScheduled() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Not thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPProcessorsScheduled: ItemCount; external name '_MPProcessorsScheduled';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { Those currently in use.}
- {
- ¤
- ===========================================================================================
- Tasking Services
- ================
- }
- const
- { For MPCreateTask options}
- kMPCreateTaskSuspendedMask = 1 shl 0; { not supported on Mac OS X}
- kMPCreateTaskTakesAllExceptionsMask = 1 shl 1;
- kMPCreateTaskNotDebuggableMask = 1 shl 2;
- kMPCreateTaskValidOptionsMask = kMPCreateTaskSuspendedMask or kMPCreateTaskTakesAllExceptionsMask or kMPCreateTaskNotDebuggableMask;
- { -------------------------------------------------------------------------------------------}
- type
- TaskProc = function( parameter: UnivPtr ): OSStatus;
- {
- * MPCreateTask() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPCreateTask( entryPoint: TaskProc; parameter: UnivPtr; stackSize: ByteCount; notifyQueue: MPQueueID; terminationParameter1: UnivPtr; terminationParameter2: UnivPtr; options: MPTaskOptions; task: MPTaskIDPtr ): OSStatus; external name '_MPCreateTask';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPTerminateTask() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPTerminateTask( task: MPTaskID; terminationStatus: OSStatus ): OSStatus; external name '_MPTerminateTask';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetTaskWeight() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetTaskWeight( task: MPTaskID; weight: MPTaskWeight ): OSStatus; external name '_MPSetTaskWeight';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPTaskIsPreemptive() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPTaskIsPreemptive( taskID: MPTaskID ): Boolean; external name '_MPTaskIsPreemptive';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { May be kInvalidID.}
- {
- * MPExit() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- procedure MPExit( status: OSStatus ); external name '_MPExit';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPYield() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- procedure MPYield; external name '_MPYield';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPCurrentTaskID() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPCurrentTaskID: MPTaskID; external name '_MPCurrentTaskID';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetTaskType()
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.1 and later in CoreServices.framework
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.3 and later
- }
- function MPSetTaskType( task: MPTaskID; taskType: OSType ): OSStatus; external name '_MPSetTaskType';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- {
- ---------------------------------------------------
- ! The task storage services are new in version 2.0.
- }
- {
- * MPAllocateTaskStorageIndex() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPAllocateTaskStorageIndex( var taskIndex: TaskStorageIndex ): OSStatus; external name '_MPAllocateTaskStorageIndex';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeallocateTaskStorageIndex() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPDeallocateTaskStorageIndex( taskIndex: TaskStorageIndex ): OSStatus; external name '_MPDeallocateTaskStorageIndex';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetTaskStorageValue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetTaskStorageValue( taskIndex: TaskStorageIndex; value: TaskStorageValue ): OSStatus; external name '_MPSetTaskStorageValue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPGetTaskStorageValue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPGetTaskStorageValue( taskIndex: TaskStorageIndex ): TaskStorageValue; external name '_MPGetTaskStorageValue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Synchronization Services
- ========================
- }
- {
- * MPCreateQueue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPCreateQueue( var queue: MPQueueID ): OSStatus; external name '_MPCreateQueue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteQueue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPDeleteQueue( queue: MPQueueID ): OSStatus; external name '_MPDeleteQueue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPNotifyQueue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPNotifyQueue( queue: MPQueueID; param1: UnivPtr; param2: UnivPtr; param3: UnivPtr ): OSStatus; external name '_MPNotifyQueue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPWaitOnQueue() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPWaitOnQueue( queue: MPQueueID; var param1: UnivPtr; var param2: UnivPtr; var param3: UnivPtr; timeout: Duration ): OSStatus; external name '_MPWaitOnQueue';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetQueueReserve() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetQueueReserve( queue: MPQueueID; count: ItemCount ): OSStatus; external name '_MPSetQueueReserve';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- {
- * MPCreateSemaphore() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPCreateSemaphore( maximumValue: MPSemaphoreCount; initialValue: MPSemaphoreCount; var semaphore: MPSemaphoreID ): OSStatus; external name '_MPCreateSemaphore';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteSemaphore() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPDeleteSemaphore( semaphore: MPSemaphoreID ): OSStatus; external name '_MPDeleteSemaphore';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSignalSemaphore() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPSignalSemaphore( semaphore: MPSemaphoreID ): OSStatus; external name '_MPSignalSemaphore';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPWaitOnSemaphore() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPWaitOnSemaphore( semaphore: MPSemaphoreID; timeout: Duration ): OSStatus; external name '_MPWaitOnSemaphore';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- {
- * MPCreateCriticalRegion() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPCreateCriticalRegion( var criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPCreateCriticalRegion';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteCriticalRegion() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPDeleteCriticalRegion( criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPDeleteCriticalRegion';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPEnterCriticalRegion() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPEnterCriticalRegion( criticalRegion: MPCriticalRegionID; timeout: Duration ): OSStatus; external name '_MPEnterCriticalRegion';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPExitCriticalRegion() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPExitCriticalRegion( criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPExitCriticalRegion';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- {
- * MPCreateEvent() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPCreateEvent( var event: MPEventID ): OSStatus; external name '_MPCreateEvent';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteEvent() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPDeleteEvent( event: MPEventID ): OSStatus; external name '_MPDeleteEvent';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetEvent() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetEvent( event: MPEventID; flags: MPEventFlags ): OSStatus; external name '_MPSetEvent';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPWaitForEvent() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPWaitForEvent( event: MPEventID; flags: MPEventFlagsPtr; timeout: Duration ): OSStatus; external name '_MPWaitForEvent';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Notification Services (API)
- =====================
- }
- {
- * MPCreateNotification()
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.1 and later
- }
- function MPCreateNotification( var notificationID: MPNotificationID ): OSStatus; external name '_MPCreateNotification';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteNotification() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.1 and later
- }
- function MPDeleteNotification( notificationID: MPNotificationID ): OSStatus; external name '_MPDeleteNotification';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPModifyNotification() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.1 and later
- }
- function MPModifyNotification( notificationID: MPNotificationID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPModifyNotification';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPModifyNotificationParameters() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.1 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.3 and later
- }
- function MPModifyNotificationParameters( notificationID: MPNotificationID; kind: MPOpaqueIDClass; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPModifyNotificationParameters';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPCauseNotification() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.1 and later
- }
- function MPCauseNotification( notificationID: MPNotificationID ): OSStatus; external name '_MPCauseNotification';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Timer Services
- ==============
- }
- {
- --------------------------------------------
- ! The timer services are new in version 2.0.
- }
- const
- { For MPArmTimer options}
- kMPPreserveTimerIDMask = 1 shl 0;
- kMPTimeIsDeltaMask = 1 shl 1;
- kMPTimeIsDurationMask = 1 shl 2;
- {
- * MPDelayUntil() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPDelayUntil( var expirationTime: AbsoluteTime ): OSStatus; external name '_MPDelayUntil';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDelayUntilSys()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibrary 2.1 and later
- }
- {
- * MPCreateTimer() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPCreateTimer( var timerID: MPTimerID ): OSStatus; external name '_MPCreateTimer';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDeleteTimer() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPDeleteTimer( timerID: MPTimerID ): OSStatus; external name '_MPDeleteTimer';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetTimerNotify() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetTimerNotify( timerID: MPTimerID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPSetTimerNotify';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPArmTimer() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPArmTimer( timerID: MPTimerID; var expirationTime: AbsoluteTime; options: OptionBits ): OSStatus; external name '_MPArmTimer';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPCancelTimer() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPCancelTimer( timerID: MPTimerID; timeRemaining: AbsoluteTimePtr ): OSStatus; external name '_MPCancelTimer';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Memory Services
- ===============
- }
- const
- { Maximum allocation request size is 1GB.}
- kMPMaxAllocSize = 1073741824;
- const
- { Values for the alignment parameter to MPAllocateAligned.}
- kMPAllocateDefaultAligned = 0;
- kMPAllocate8ByteAligned = 3;
- kMPAllocate16ByteAligned = 4;
- kMPAllocate32ByteAligned = 5;
- kMPAllocate1024ByteAligned = 10;
- kMPAllocate4096ByteAligned = 12;
- kMPAllocateMaxAlignment = 16; { Somewhat arbitrary limit on expectations.}
- kMPAllocateAltiVecAligned = kMPAllocate16ByteAligned; { The P.C. name.}
- kMPAllocateVMXAligned = kMPAllocateAltiVecAligned; { The older, common name.}
- kMPAllocateVMPageAligned = 254; { Pseudo value, converted at runtime.}
- kMPAllocateInterlockAligned = 255; { Pseudo value, converted at runtime.}
- const
- { Values for the options parameter to MPAllocateAligned.}
- kMPAllocateClearMask = $0001; { Zero the allocated block.}
- kMPAllocateGloballyMask = $0002; { Allocate from the globally visible pool.}
- kMPAllocateResidentMask = $0004; { Allocate from the RAM-resident pool.}
- kMPAllocateNoGrowthMask = $0010; { Do not attempt to grow the pool.}
- kMPAllocateNoCreateMask = $0020; { Do not attempt to create the pool if it doesn't exist yet.}
- { -------------------------------------------------------------------------------------------}
- {
- * MPAllocateAligned() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPAllocateAligned( size: ByteCount; alignment: UInt8; options: OptionBits ): LogicalAddress; external name '_MPAllocateAligned';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { ! MPAllocateAligned is new in version 2.0.}
- {
- * MPAllocate() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function MPAllocate( size: ByteCount ): LogicalAddress; external name '_MPAllocate';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { Use MPAllocateAligned instead.}
- {
- * MPFree() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- procedure MPFree( objct: LogicalAddress ); external name '_MPFree';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPGetAllocatedBlockSize() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPGetAllocatedBlockSize( objct: LogicalAddress ): ByteCount; external name '_MPGetAllocatedBlockSize';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- {
- * MPBlockCopy() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- procedure MPBlockCopy( source: LogicalAddress; destination: LogicalAddress; size: ByteCount ); external name '_MPBlockCopy';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPBlockClear() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- procedure MPBlockClear( address: LogicalAddress; size: ByteCount ); external name '_MPBlockClear';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {$ifc not TARGET_CPU_64}
- {
- * MPDataToCode() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- procedure MPDataToCode( address: LogicalAddress; size: ByteCount ); external name '_MPDataToCode';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { NOTE: MPDataToCode is not supported for 64-bit applications. Use mprotect(2) instead.}
- {
- ¤
- ===========================================================================================
- Exception/Debugging Services
- ============================
- }
- {
- -------------------------------------------------------------------------------------------
- *** Important Note ***
- ----------------------
-
- The functions MPExtractTaskState and MPSetTaskState infer the size of the "info" buffer
- from the "kind" parameter. A given value for MPTaskStateKind will always refer to a
- single specific physical buffer layout. Should new register sets be added, or the size
- or number of any registers change, new values of MPTaskStateKind will be introduced to
- refer to the new buffer layouts.
-
- The following types for the buffers are in MachineExceptions. The correspondence between
- MPTaskStateKind values and MachineExceptions types is:
-
- kMPTaskStateRegisters -> RegisterInformation
- kMPTaskStateFPU -> FPUInformation
- kMPTaskStateVectors -> VectorInformation
- kMPTaskStateMachine -> MachineInformation
- kMPTaskState32BitMemoryException -> ExceptionInfo for old-style 32-bit memory exceptions
-
- For reference, on PowerPC the MachineExceptions types contain:
-
- RegisterInformation -> The GPRs, 32 values of 64 bits each.
- FPUInformation -> The FPRs plus FPSCR, 32 values of 64 bits each, one value of
- 32 bits.
- VectorInformation -> The AltiVec vector registers plus VSCR and VRSave, 32 values
- of 128 bits each, one value of 128 bits, and one 32 bit value.
- MachineInformation -> The CTR, LR, PC, each of 64 bits. The CR, XER, MSR, MQ,
- exception kind, and DSISR, each of 32 bits. The 64 bit DAR.
- ExceptionInfo -> Only memory exceptions are specified, 4 fields of 32 bits each.
- Note that this type only covers memory exceptions on 32-bit CPUs!
- The following types are declared here:
- kMPTaskStateTaskInfo -> MPTaskInfo
- }
- {$endc} {not TARGET_CPU_64}
- const
- { Values for the TaskStateKind to MPExtractTaskState and MPSetTaskState.}
- kMPTaskStateRegisters = 0; { The task general registers.}
- kMPTaskStateFPU = 1; { The task floating point registers}
- kMPTaskStateVectors = 2; { The task vector registers}
- kMPTaskStateMachine = 3; { The task machine registers}
- kMPTaskState32BitMemoryException = 4; { The task memory exception information for 32-bit CPUs.}
- kMPTaskStateTaskInfo = 5; { Static and dynamic information about the task.}
- const
- { Option bits and numbers for MPDisposeTaskException.}
- kMPTaskPropagate = 0; { The exception is propagated.}
- kMPTaskResumeStep = 1; { The task is resumed and single step is enabled.}
- kMPTaskResumeBranch = 2; { The task is resumed and branch stepping is enabled.}
- kMPTaskResumeMask = $0000; { The task is resumed.}
- kMPTaskPropagateMask = 1 shl kMPTaskPropagate; { The exception is propagated.}
- kMPTaskResumeStepMask = 1 shl kMPTaskResumeStep; { The task is resumed and single step is enabled.}
- kMPTaskResumeBranchMask = 1 shl kMPTaskResumeBranch; { The task is resumed and branch stepping is enabled.}
- const
- { For kMPTaskStateTaskInfo, the task's runState}
- kMPTaskBlocked = 0; { Task is blocked (queued on resource)}
- kMPTaskReady = 1; { Task is runnable}
- kMPTaskRunning = 2; { Task is running}
- const
- { For kMPTaskStateTaskInfo, the version of the MPTaskInfo structure requested.}
- kMPTaskInfoVersion = 3;
- type
- MPTaskInfoVersion2Ptr = ^MPTaskInfoVersion2;
- MPTaskInfoVersion2 = record
- version: PBVersion; { Version 2 of the data structure requested}
- name: OSType; { Task name}
- queueName: OSType; { Task's queue owner name}
- runState: UInt16; { Running, ready, blocked}
- lastCPU: UInt16; { Address of CPU where task previously ran}
- weight: UInt32; { Processing weight: 1 - 10,000}
- processID: MPProcessID; { Owning process ID}
- cpuTime: AbsoluteTime; { Accumulated task time}
- schedTime: AbsoluteTime; { Time when last scheduled}
- creationTime: AbsoluteTime; { Time when task created}
- codePageFaults: ItemCount; { Page faults from code execution}
- dataPageFaults: ItemCount; { Page faults from data access}
- preemptions: ItemCount; { Number of times task was preempted}
- cpuID: MPCpuID; { ID of CPU where task previously ran}
- end;
- type
- MPTaskInfoPtr = ^MPTaskInfo;
- MPTaskInfo = record
- version: PBVersion; { Version 3 of the data structure requested}
- name: OSType; { Task name}
- queueName: OSType; { Task's queue owner name}
- runState: UInt16; { Running, ready, blocked}
- lastCPU: UInt16; { Address of CPU where task previously ran}
- weight: UInt32; { Processing weight: 1 - 10,000}
- processID: MPProcessID; { Owning process ID}
- cpuTime: AbsoluteTime; { Accumulated task time}
- schedTime: AbsoluteTime; { Time when last scheduled}
- creationTime: AbsoluteTime; { Time when task created}
- codePageFaults: ItemCount; { Page faults from code execution}
- dataPageFaults: ItemCount; { Page faults from data access}
- preemptions: ItemCount; { Number of times task was preempted}
- cpuID: MPCpuID; { ID of CPU where task previously ran.}
- blockedObject: MPOpaqueID; { ID of blocked object.}
- spaceID: MPAddressSpaceID; { Address space ID of this task.}
- stackBase: LogicalAddress; { Base of stack (lowest address).}
- stackLimit: LogicalAddress; { Stack limit (highest address).}
- stackCurr: LogicalAddress; { Current stack address.}
- end;
- {
- Upon a task exception, the following message is sent to the designated queue:
- 1. The MPTaskID,
- 2. The exception kind. These are enumerated in the interfaces header MachineExceptions.h
- 3. N/A
- }
- { -------------------------------------------------------------------------------------------}
- {
- * MPSetExceptionHandler() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetExceptionHandler( task: MPTaskID; exceptionQ: MPQueueID ): OSStatus; external name '_MPSetExceptionHandler';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPDisposeTaskException() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPDisposeTaskException( task: MPTaskID; action: OptionBits ): OSStatus; external name '_MPDisposeTaskException';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPExtractTaskState() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPExtractTaskState( task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr ): OSStatus; external name '_MPExtractTaskState';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPSetTaskState() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPSetTaskState( task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr ): OSStatus; external name '_MPSetTaskState';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPThrowException() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPThrowException( task: MPTaskID; kind: MPExceptionKind ): OSStatus; external name '_MPThrowException';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- { -------------------------------------------------------------------------------------------}
- type
- MPDebuggerLevel = UInt32;
- const
- kMPLowLevelDebugger = $00000000; { MacsBug-like}
- kMPMidLevelDebugger = $10000000; { Jasik-like}
- kMPHighLevelDebugger = $20000000; { Metrowerks-like}
- {
- * MPRegisterDebugger() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPRegisterDebugger( queue: MPQueueID; level: MPDebuggerLevel ): OSStatus; external name '_MPRegisterDebugger';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPUnregisterDebugger() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPUnregisterDebugger( queue: MPQueueID ): OSStatus; external name '_MPUnregisterDebugger';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Remote Call Services
- ====================
- }
- type
- MPRemoteProcedure = function( parameter: UnivPtr ): UnivPtr;
- type
- MPRemoteContext = UInt8;
- const
- kMPAnyRemoteContext = 0;
- kMPOwningProcessRemoteContext = 1;
- kMPInterruptRemoteContext = 2;
- kMPAsyncInterruptRemoteContext = 3;
- {
- * MPRemoteCall() *** DEPRECATED ***
- *
- * Summary:
- * Calls a nonreentrant function and blocks the current task.
- *
- * Discussion:
- * You use this function primarily to indirectly execute Mac OS
- * system software functions. The task making the remote call is
- * blocked until the call completes. The amount of time taken to
- * schedule the remote procedure depends on the choice of the
- * designated operating context. Specifying kMPAnyRemoteContext
- * offers the lowest latency, but the called procedure may not have
- * access to process-specific resources such as some low-memory
- * values. Specifying kMPOwningProcessRemoteContext has higher
- * latency because the remote procedure is deferred until the owning
- * process becomes active. However, the remote procedure is
- * guaranteed to execute within the owning process. Note that with
- * the exception of functions in Multiprocessing Services, you
- * cannot safely call any system software functions directly from a
- * preemptive task. Even if some system software function appears to
- * work today when called from a preemptive task, unless explicitly
- * stated otherwise there is no guarantee that subsequent versions
- * of the same function will continue to work in future versions of
- * system software. In Mac OS 8 implementations of Multiprocessing
- * Services, the only exceptions to this rule are the atomic memory
- * operations (such as AddAtomic ) exported in the InterfaceLib
- * shared library. Even these functions may switch to 68K mode if
- * the operands to them are not aligned. If you need to access
- * system software functions from a preemptive task, you must do so
- * using the MPRemoteCall function. %% @deprecated Use blocks to
- * make a call on anothed dispatch queue() and block on the result.
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Parameters:
- *
- * remoteProc:
- * A pointer of type MPRemoteProcedure that references the
- * application-defined function you want to call. See
- * MyRemoteProcedure for more information about the form of this
- * function.
- *
- * parameter:
- * A pointer to a parameter to pass to the application-defined
- * function. For example, this value could point to a data
- * structure or a memory location.
- *
- * context:
- * A value of type MPRemoteContext that specifies which contexts
- * (that is processes) are allowed to execute the function. See
- * ÒRemote Call Context Option ConstantsÓ for a list of possible
- * values.
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPRemoteCall( remoteProc: MPRemoteProcedure; parameter: UnivPtr; context: MPRemoteContext ): UnivPtr; external name '_MPRemoteCall';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- * MPRemoteCallCFM() *** DEPRECATED ***
- *
- * Deprecated:
- * No longer applicable now that the Multiprocessing Utilities have
- * been deprecated.
- *
- * Summary:
- * Calls a nonreentrant function and blocks the current task.
- *
- * Discussion:
- * You use this function primarily to indirectly execute Mac OS
- * system software functions. The task making the remote call is
- * blocked until the call completes. The amount of time taken to
- * schedule the remote procedure depends on the choice of the
- * designated operating context. Specifying kMPAnyRemoteContext
- * offers the lowest latency, but the called procedure may not have
- * access to process-specific resources such as some low-memory
- * values. Specifying kMPOwningProcessRemoteContext has higher
- * latency because the remote procedure is deferred until the owning
- * process becomes active. However, the remote procedure is
- * guaranteed to execute within the owning process. Note that with
- * the exception of functions in Multiprocessing Services, you
- * cannot safely call any system software functions directly from a
- * preemptive task. Even if some system software function appears to
- * work today when called from a preemptive task, unless explicitly
- * stated otherwise there is no guarantee that subsequent versions
- * of the same function will continue to work in future versions of
- * system software.
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Parameters:
- *
- * remoteProc:
- * A pointer of type MPRemoteProcedure to a CFM function that
- * references the application-defined function you want to call.
- * See MyRemoteProcedure for more information about the form of
- * this function.
- *
- * parameter:
- * A pointer to a parameter to pass to the application-defined
- * function. For example, this value could point to a data
- * structure or a memory location.
- *
- * context:
- * A value of type MPRemoteContext that specifies which contexts
- * (that is processes) are allowed to execute the function. See
- * ÒRemote Call Context Option ConstantsÓ for a list of possible
- * values.
- *
- * Availability:
- * Mac OS X: in version 10.4 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibrary 2.0 and later
- }
- function MPRemoteCallCFM( remoteProc: MPRemoteProcedure; parameter: UnivPtr; context: MPRemoteContext ): UnivPtr; external name '_MPRemoteCallCFM';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Checking API Availability
- =========================
- }
- {
- ===========================================================================================
- *** WARNING: You must properly check the availability of MP services before calling them!
- ===========================================================================================
-
- Checking for the availability of the MP API is rather ugly. This is a historical problem,
- caused by the original implementation letting itself get prepared when it really wasn't
- usable and complicated by some important clients then depending on weak linking to "work".
- (And further complicated by CFM not supporting "deferred" imports, which is how many
- programmers think weak imports work.)
-
- The end result is that the MP API library may get prepared by CFM but be totally unusable.
- This means that if you import from the MP API library, you cannot simply check for a
- resolved import to decide if MP services are available. Worse, if you explicitly prepare
- the MP API library you cannot assume that a noErr result from GetSharedLibrary means that
- MP services are available.
-
- ¥ If you import from the MP API library you MUST:
-
- Use the MPLibraryIsLoaded macro (or equivalent code in languages other than C) to tell
- if the MP API services are available. It is not sufficient to simply check that an
- imported symbol is resolved as is commonly done for other libraries. The macro expands
- to the expression:
-
- ( ( (UInt32)_MPIsFullyInitialized != (UInt32)kUnresolvedCFragSymbolAddress ) &&
- ( _MPIsFullyInitialized () ) )
-
- This checks if the imported symbol _MPIsFullyInitialized is resolved and if resolved
- calls it. Both parts must succeed for the MP API services to be available.
-
- ¥ If you explicitly prepare the MP API library you MUST:
-
- Use code similar to the following example to tell if the MP API services are available.
- It is not sufficient to depend on just a noErr result from GetSharedLibrary.
-
- OSErr err;
- Boolean mpIsAvailable = false;
- CFragConnectionID connID = kInvalidID;
- MPIsFullyInitializedProc mpIsFullyInitialized = NULL;
-
- err = GetSharedLibrary ( "\pMPLibrary", kCompiledCFragArch, kReferenceCFrag,
- &connID, NULL, NULL );
-
- if ( err == noErr ) (
- err = FindSymbol ( connID, "\p_MPIsFullyInitialized",
- (Ptr *) &mpIsFullyInitialized, NULL );
- )
-
- if ( err == noErr ) (
- mpIsAvailable = (* mpIsFullyInitialized) ();
- )
-
- ===========================================================================================
- }
- {
- * _MPIsFullyInitialized() *** DEPRECATED ***
- *
- * Mac OS X threading:
- * Thread safe
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function _MPIsFullyInitialized: Boolean; external name '__MPIsFullyInitialized';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- type
- MPIsFullyInitializedProc = function: Boolean;
- const
- kMPUnresolvedCFragSymbolAddress = 0;
- MPLibraryIsLoaded = true;
- {
- ¤
- ===========================================================================================
- Miscellaneous Services
- ======================
- }
- {
- * _MPLibraryVersion() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- procedure _MPLibraryVersion( versionCString: ConstCStringPtrPtr; major: UInt32Ptr; minor: UInt32Ptr; release: UInt32Ptr; revision: UInt32Ptr ); external name '__MPLibraryVersion';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Unofficial Services
- ===================
- }
- {
- ===========================================================================================
- *** WARNING ***
- These services are not part of the officially documented multiprocessing API. They may not
- be avaliable in future versions of Mac OS multiprocessing support, or in environments that
- have a different underlying OS architecture such as Mac OS on top of a microkernel, the
- Mac OS Blue Box under Mac OS X, native MP support in Mac OS X, etc.
- ===========================================================================================
- }
- {$ifc CALL_NOT_IN_CARBON}
- {
- * _MPAllocateSys()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- { Use MPAllocateAligned instead.}
- {
- * _MPRPC()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- { Use _MPRemoteCall instead.}
- {
- * _MPTaskIsToolboxSafe()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- {$endc} {CALL_NOT_IN_CARBON}
- {
- * _MPLibraryIsCompatible() *** DEPRECATED ***
- *
- * Availability:
- * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
- * CarbonLib: in CarbonLib 1.0 and later
- * Non-Carbon CFM: in MPLibrary 1.0 and later
- }
- function _MPLibraryIsCompatible( versionCString: ConstCStringPtr; major: UInt32; minor: UInt32; release: UInt32; revision: UInt32 ): Boolean; external name '__MPLibraryIsCompatible';
- (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
- {
- ¤
- ===========================================================================================
- Defunct Services
- ================
- }
- {$ifc CALL_NOT_IN_CARBON}
- {$ifc undefined MPIncludeDefunctServices}
- {$setc MPIncludeDefunctServices := 0}
- {$endc}
- {$ifc MPIncludeDefunctServices}
- {
- * _MPDebugStr()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
- }
- {
- * _MPStatusPString()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
- }
- {
- * _MPStatusCString()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
- }
- type
- MPPrintfHandler = procedure( taskID: MPTaskID; format: ConstCStringPtr; args: va_list );
- {
- * _MPInitializePrintf()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
- }
- {
- * _MPPrintf()
- *
- * Availability:
- * Mac OS X: not available
- * CarbonLib: not available
- * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
- }
- {$endc} {MPIncludeDefunctServices}
- {$endc} {CALL_NOT_IN_CARBON}
- { ===========================================================================================}
- {$endc} {TARGET_OS_MAC}
- {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
- end.
- {$endc} {not MACOSALLINCLUDE}
|