Multiprocessing.pas 68 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024
  1. {
  2. File: CarbonCore/Multiprocessing.h
  3. Contains: Multiprocessing interfaces
  4. The contents of this header file are deprecated.
  5. Copyright: © 1995-2011 DayStar Digital, Inc.
  6. }
  7. {
  8. Modified for use with Free Pascal
  9. Version 308
  10. Please report any bugs to <[email protected]>
  11. }
  12. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  13. {$mode macpas}
  14. {$modeswitch cblocks}
  15. {$packenum 1}
  16. {$macro on}
  17. {$inline on}
  18. {$calling mwpascal}
  19. {$IFNDEF FPC_DOTTEDUNITS}
  20. unit Multiprocessing;
  21. {$ENDIF FPC_DOTTEDUNITS}
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0400}
  24. {$setc GAP_INTERFACES_VERSION := $0308}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC32}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __ppc64__ and defined CPUPOWERPC64}
  40. {$setc __ppc64__ := 1}
  41. {$elsec}
  42. {$setc __ppc64__ := 0}
  43. {$endc}
  44. {$ifc not defined __i386__ and defined CPUI386}
  45. {$setc __i386__ := 1}
  46. {$elsec}
  47. {$setc __i386__ := 0}
  48. {$endc}
  49. {$ifc not defined __x86_64__ and defined CPUX86_64}
  50. {$setc __x86_64__ := 1}
  51. {$elsec}
  52. {$setc __x86_64__ := 0}
  53. {$endc}
  54. {$ifc not defined __arm__ and defined CPUARM}
  55. {$setc __arm__ := 1}
  56. {$elsec}
  57. {$setc __arm__ := 0}
  58. {$endc}
  59. {$ifc not defined __arm64__ and defined CPUAARCH64}
  60. {$setc __arm64__ := 1}
  61. {$elsec}
  62. {$setc __arm64__ := 0}
  63. {$endc}
  64. {$ifc defined cpu64}
  65. {$setc __LP64__ := 1}
  66. {$elsec}
  67. {$setc __LP64__ := 0}
  68. {$endc}
  69. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  70. {$error Conflicting definitions for __ppc__ and __i386__}
  71. {$endc}
  72. {$ifc defined __ppc__ and __ppc__}
  73. {$setc TARGET_CPU_PPC := TRUE}
  74. {$setc TARGET_CPU_PPC64 := FALSE}
  75. {$setc TARGET_CPU_X86 := FALSE}
  76. {$setc TARGET_CPU_X86_64 := FALSE}
  77. {$setc TARGET_CPU_ARM := FALSE}
  78. {$setc TARGET_CPU_ARM64 := FALSE}
  79. {$setc TARGET_OS_MAC := TRUE}
  80. {$setc TARGET_OS_IPHONE := FALSE}
  81. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  82. {$setc TARGET_OS_EMBEDDED := FALSE}
  83. {$elifc defined __ppc64__ and __ppc64__}
  84. {$setc TARGET_CPU_PPC := FALSE}
  85. {$setc TARGET_CPU_PPC64 := TRUE}
  86. {$setc TARGET_CPU_X86 := FALSE}
  87. {$setc TARGET_CPU_X86_64 := FALSE}
  88. {$setc TARGET_CPU_ARM := FALSE}
  89. {$setc TARGET_CPU_ARM64 := FALSE}
  90. {$setc TARGET_OS_MAC := TRUE}
  91. {$setc TARGET_OS_IPHONE := FALSE}
  92. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  93. {$setc TARGET_OS_EMBEDDED := FALSE}
  94. {$elifc defined __i386__ and __i386__}
  95. {$setc TARGET_CPU_PPC := FALSE}
  96. {$setc TARGET_CPU_PPC64 := FALSE}
  97. {$setc TARGET_CPU_X86 := TRUE}
  98. {$setc TARGET_CPU_X86_64 := FALSE}
  99. {$setc TARGET_CPU_ARM := FALSE}
  100. {$setc TARGET_CPU_ARM64 := FALSE}
  101. {$ifc defined iphonesim}
  102. {$setc TARGET_OS_MAC := FALSE}
  103. {$setc TARGET_OS_IPHONE := TRUE}
  104. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  105. {$elsec}
  106. {$setc TARGET_OS_MAC := TRUE}
  107. {$setc TARGET_OS_IPHONE := FALSE}
  108. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  109. {$endc}
  110. {$setc TARGET_OS_EMBEDDED := FALSE}
  111. {$elifc defined __x86_64__ and __x86_64__}
  112. {$setc TARGET_CPU_PPC := FALSE}
  113. {$setc TARGET_CPU_PPC64 := FALSE}
  114. {$setc TARGET_CPU_X86 := FALSE}
  115. {$setc TARGET_CPU_X86_64 := TRUE}
  116. {$setc TARGET_CPU_ARM := FALSE}
  117. {$setc TARGET_CPU_ARM64 := FALSE}
  118. {$ifc defined iphonesim}
  119. {$setc TARGET_OS_MAC := FALSE}
  120. {$setc TARGET_OS_IPHONE := TRUE}
  121. {$setc TARGET_IPHONE_SIMULATOR := TRUE}
  122. {$elsec}
  123. {$setc TARGET_OS_MAC := TRUE}
  124. {$setc TARGET_OS_IPHONE := FALSE}
  125. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  126. {$endc}
  127. {$setc TARGET_OS_EMBEDDED := FALSE}
  128. {$elifc defined __arm__ and __arm__}
  129. {$setc TARGET_CPU_PPC := FALSE}
  130. {$setc TARGET_CPU_PPC64 := FALSE}
  131. {$setc TARGET_CPU_X86 := FALSE}
  132. {$setc TARGET_CPU_X86_64 := FALSE}
  133. {$setc TARGET_CPU_ARM := TRUE}
  134. {$setc TARGET_CPU_ARM64 := FALSE}
  135. {$setc TARGET_OS_MAC := FALSE}
  136. {$setc TARGET_OS_IPHONE := TRUE}
  137. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  138. {$setc TARGET_OS_EMBEDDED := TRUE}
  139. {$elifc defined __arm64__ and __arm64__}
  140. {$setc TARGET_CPU_PPC := FALSE}
  141. {$setc TARGET_CPU_PPC64 := FALSE}
  142. {$setc TARGET_CPU_X86 := FALSE}
  143. {$setc TARGET_CPU_X86_64 := FALSE}
  144. {$setc TARGET_CPU_ARM := FALSE}
  145. {$setc TARGET_CPU_ARM64 := TRUE}
  146. {$ifc defined ios}
  147. {$setc TARGET_OS_MAC := FALSE}
  148. {$setc TARGET_OS_IPHONE := TRUE}
  149. {$setc TARGET_OS_EMBEDDED := TRUE}
  150. {$elsec}
  151. {$setc TARGET_OS_MAC := TRUE}
  152. {$setc TARGET_OS_IPHONE := FALSE}
  153. {$setc TARGET_OS_EMBEDDED := FALSE}
  154. {$endc}
  155. {$setc TARGET_IPHONE_SIMULATOR := FALSE}
  156. {$elsec}
  157. {$error __ppc__ nor __ppc64__ nor __i386__ nor __x86_64__ nor __arm__ nor __arm64__ is defined.}
  158. {$endc}
  159. {$ifc defined __LP64__ and __LP64__ }
  160. {$setc TARGET_CPU_64 := TRUE}
  161. {$elsec}
  162. {$setc TARGET_CPU_64 := FALSE}
  163. {$endc}
  164. {$ifc defined FPC_BIG_ENDIAN}
  165. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  166. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  167. {$elifc defined FPC_LITTLE_ENDIAN}
  168. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  169. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  170. {$elsec}
  171. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  172. {$endc}
  173. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  174. {$setc CALL_NOT_IN_CARBON := FALSE}
  175. {$setc OLDROUTINENAMES := FALSE}
  176. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  177. {$setc OPAQUE_UPP_TYPES := TRUE}
  178. {$setc OTCARBONAPPLICATION := TRUE}
  179. {$setc OTKERNEL := FALSE}
  180. {$setc PM_USE_SESSION_APIS := TRUE}
  181. {$setc TARGET_API_MAC_CARBON := TRUE}
  182. {$setc TARGET_API_MAC_OS8 := FALSE}
  183. {$setc TARGET_API_MAC_OSX := TRUE}
  184. {$setc TARGET_CARBON := TRUE}
  185. {$setc TARGET_CPU_68K := FALSE}
  186. {$setc TARGET_CPU_MIPS := FALSE}
  187. {$setc TARGET_CPU_SPARC := FALSE}
  188. {$setc TARGET_OS_UNIX := FALSE}
  189. {$setc TARGET_OS_WIN32 := FALSE}
  190. {$setc TARGET_RT_MAC_68881 := FALSE}
  191. {$setc TARGET_RT_MAC_CFM := FALSE}
  192. {$setc TARGET_RT_MAC_MACHO := TRUE}
  193. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  194. {$setc TYPE_BOOL := FALSE}
  195. {$setc TYPE_EXTENDED := FALSE}
  196. {$setc TYPE_LONGLONG := TRUE}
  197. {$IFDEF FPC_DOTTEDUNITS}
  198. uses MacOsApi.MacTypes;
  199. {$ELSE FPC_DOTTEDUNITS}
  200. uses MacTypes;
  201. {$ENDIF FPC_DOTTEDUNITS}
  202. {$endc} {not MACOSALLINCLUDE}
  203. {$ifc TARGET_OS_MAC}
  204. {********************************************************************************************
  205. The Multiprocessing Utilities are deprecated. Callers should use blocks, libDispatch, or pthreads.
  206. ********************************************************************************************}
  207. {
  208. ===========================================================================================
  209. *** WARNING: You must properly check the availability of MP services before calling them!
  210. See the section titled "Checking API Availability".
  211. ===========================================================================================
  212. }
  213. {$ALIGN POWER}
  214. {
  215. ======================================= NOTICE ============================================
  216. As of Mac OS X v10.6, the APIs in this header file are discouraged. These APIs are slated
  217. for deprecation in the next major release of OS X. The new dispatch APIs (see dispatch(3))
  218. replace the Multiprocessing APIs and the pthread threading APIs.
  219. ===========================================================================================
  220. }
  221. {
  222. ===========================================================================================
  223. This is the header file for version 2.2 of the Mac OS multiprocessing support. This version
  224. has been totally reimplemented and has significant new services. The main goal of the
  225. reimplementation has been to transfer task management into the core operating system to provide
  226. much more reliable and more efficient operation, including on single processor machines.
  227. The memory management has also been massively improved, it is much faster and wastes much
  228. less space. New services include POSIX style per-task storage, timers with millisecond and
  229. microsecond resolutions, memory allocation at a specified alignment, and system pageable
  230. and RAM resident memory pools. See the MP API documentation for details.
  231. The old "DayStar" debugging services (whose names began with an underscore) have been
  232. removed from this header. A very few are still implemented for binary compatibility, or in
  233. cases where they happened to be exposed inappropriately. (E.g. _MPIsFullyInitialized must
  234. be called to see if the MP API is ReallyTrulyª usable.) New code and recompiles of old
  235. code should avoid use of these defunct services, except for _MPIsFullyInitialized.
  236. ===========================================================================================
  237. }
  238. {
  239. ===========================================================================================
  240. The following services are from the original MP API and remain supported in version 2.0:
  241. MPProcessors
  242. MPCreateTask
  243. MPTerminateTask
  244. MPCurrentTaskID
  245. MPYield
  246. MPExit
  247. MPCreateQueue
  248. MPDeleteQueue
  249. MPNotifyQueue
  250. MPWaitOnQueue
  251. MPCreateSemaphore
  252. MPCreateBinarySemaphore (In C only, a macro that calls MPCreateSemaphore.)
  253. MPDeleteSemaphore
  254. MPSignalSemaphore
  255. MPWaitOnSemaphore
  256. MPCreateCriticalRegion
  257. MPDeleteCriticalRegion
  258. MPEnterCriticalRegion
  259. MPExitCriticalRegion
  260. MPAllocate (Deprecated, use MPAllocateAligned for new builds.)
  261. MPFree
  262. MPBlockCopy
  263. MPLibraryIsLoaded (In C only, a macro.)
  264. _MPIsFullyInitialized (See comments about checking for MP API availability.)
  265. ===========================================================================================
  266. }
  267. {
  268. ===========================================================================================
  269. The following services are new in version 2.0:
  270. MPProcessorsScheduled
  271. MPSetTaskWeight
  272. MPTaskIsPreemptive
  273. MPAllocateTaskStorageIndex
  274. MPDeallocateTaskStorageIndex
  275. MPSetTaskStorageValue
  276. MPGetTaskStorageValue
  277. MPSetQueueReserve
  278. MPCreateEvent
  279. MPDeleteEvent
  280. MPSetEvent
  281. MPWaitForEvent
  282. UpTime
  283. DurationToAbsolute
  284. AbsoluteToDuration
  285. MPDelayUntil
  286. MPCreateTimer
  287. MPDeleteTimer
  288. MPSetTimerNotify
  289. MPArmTimer
  290. MPCancelTimer
  291. MPSetExceptionHandler
  292. MPThrowException
  293. MPDisposeTaskException
  294. MPExtractTaskState
  295. MPSetTaskState
  296. MPRegisterDebugger
  297. MPUnregisterDebugger
  298. MPAllocateAligned (Preferred over MPAllocate.)
  299. MPGetAllocatedBlockSize
  300. MPBlockClear
  301. MPDataToCode
  302. MPRemoteCall (Preferred over _MPRPC.)
  303. ===========================================================================================
  304. }
  305. {
  306. ===========================================================================================
  307. The following services are new in version 2.1:
  308. MPCreateNotification
  309. MPDeleteNotification
  310. MPModifyNotification
  311. MPCauseNotification
  312. MPGetNextTaskID
  313. MPGetNextCpuID
  314. ===========================================================================================
  315. }
  316. {
  317. ===========================================================================================
  318. The following services are "unofficial" extensions to the original API. They are not in
  319. the multiprocessing API documentation, but were in previous versions of this header. They
  320. remain supported in version 2.0. They may not be supported in other environments.
  321. _MPRPC (Deprecated, use MPRemoteCall for new builds.)
  322. _MPAllocateSys (Deprecated, use MPAllocateAligned for new builds.)
  323. _MPTaskIsToolboxSafe
  324. _MPLibraryVersion
  325. _MPLibraryIsCompatible
  326. ===========================================================================================
  327. }
  328. {
  329. ===========================================================================================
  330. The following services were in previous versions of this header for "debugging only" use.
  331. They are NOT implemented in version 2.0. For old builds they can be accessed by defining
  332. the symbol MPIncludeDefunctServices to have a nonzero value.
  333. _MPInitializePrintf
  334. _MPPrintf
  335. _MPDebugStr
  336. _MPStatusPString
  337. _MPStatusCString
  338. ===========================================================================================
  339. }
  340. {
  341. ¤
  342. ===========================================================================================
  343. General Types and Constants
  344. ===========================
  345. }
  346. const
  347. MPCopyrightNotice = 'Copyright © 1995-2000 Apple Computer, Inc.';
  348. const
  349. MPLibraryName = 'MPLibrary';
  350. MPLibraryCName = MPLibraryName;
  351. MPLibraryPName = MPLibraryName;
  352. const
  353. MP_API_Version = '2.3';
  354. const
  355. MPLibrary_MajorVersion = 2; { ! When these change be sure to update the build versions}
  356. MPLibrary_MinorVersion = 3; { ! used in the startup check in MPInitializeAPI!}
  357. MPLibrary_Release = 1;
  358. MPLibrary_DevelopmentRevision = 1;
  359. type
  360. MPProcessID = ^OpaqueMPProcessID; { an opaque type }
  361. OpaqueMPProcessID = record end;
  362. MPProcessIDPtr = ^MPProcessID;
  363. MPTaskID = ^OpaqueMPTaskID; { an opaque type }
  364. OpaqueMPTaskID = record end;
  365. MPTaskIDPtr = ^MPTaskID;
  366. MPQueueID = ^OpaqueMPQueueID; { an opaque type }
  367. OpaqueMPQueueID = record end;
  368. MPQueueIDPtr = ^MPQueueID;
  369. MPSemaphoreID = ^OpaqueMPSemaphoreID; { an opaque type }
  370. OpaqueMPSemaphoreID = record end;
  371. MPSemaphoreIDPtr = ^MPSemaphoreID;
  372. MPCriticalRegionID = ^OpaqueMPCriticalRegionID; { an opaque type }
  373. OpaqueMPCriticalRegionID = record end;
  374. MPCriticalRegionIDPtr = ^MPCriticalRegionID;
  375. MPTimerID = ^OpaqueMPTimerID; { an opaque type }
  376. OpaqueMPTimerID = record end;
  377. MPTimerIDPtr = ^MPTimerID;
  378. MPEventID = ^OpaqueMPEventID; { an opaque type }
  379. OpaqueMPEventID = record end;
  380. MPEventIDPtr = ^MPEventID;
  381. MPAddressSpaceID = ^OpaqueMPAddressSpaceID; { an opaque type }
  382. OpaqueMPAddressSpaceID = record end;
  383. MPAddressSpaceIDPtr = ^MPAddressSpaceID;
  384. MPNotificationID = ^OpaqueMPNotificationID; { an opaque type }
  385. OpaqueMPNotificationID = record end;
  386. MPNotificationIDPtr = ^MPNotificationID;
  387. MPCoherenceID = ^OpaqueMPCoherenceID; { an opaque type }
  388. OpaqueMPCoherenceID = record end;
  389. MPCoherenceIDPtr = ^MPCoherenceID;
  390. MPCpuID = ^OpaqueMPCpuID; { an opaque type }
  391. OpaqueMPCpuID = record end;
  392. MPCpuIDPtr = ^MPCpuID;
  393. MPAreaID = ^OpaqueMPAreaID; { an opaque type }
  394. OpaqueMPAreaID = record end;
  395. MPAreaIDPtr = ^MPAreaID;
  396. MPConsoleID = ^OpaqueMPConsoleID; { an opaque type }
  397. OpaqueMPConsoleID = record end;
  398. MPConsoleIDPtr = ^MPConsoleID;
  399. MPOpaqueID = ^OpaqueMPOpaqueID; { an opaque type }
  400. OpaqueMPOpaqueID = record end;
  401. MPOpaqueIDPtr = ^MPOpaqueID;
  402. const
  403. { Values for MPOpaqueIDClass.}
  404. kOpaqueAnyID = 0;
  405. kOpaqueProcessID = 1;
  406. kOpaqueTaskID = 2;
  407. kOpaqueTimerID = 3;
  408. kOpaqueQueueID = 4;
  409. kOpaqueSemaphoreID = 5;
  410. kOpaqueCriticalRegionID = 6;
  411. kOpaqueCpuID = 7;
  412. kOpaqueAddressSpaceID = 8;
  413. kOpaqueEventID = 9;
  414. kOpaqueCoherenceID = 10;
  415. kOpaqueAreaID = 11;
  416. kOpaqueNotificationID = 12;
  417. kOpaqueConsoleID = 13;
  418. type
  419. MPOpaqueIDClass = UInt32;
  420. const
  421. kMPNoID = kInvalidID; { New code should use kInvalidID everywhere.}
  422. type
  423. MPTaskOptions = OptionBits;
  424. MPTaskOptionsPtr = ^MPTaskOptions;
  425. TaskStorageIndex = ItemCount;
  426. TaskStorageIndexPtr = ^TaskStorageIndex;
  427. TaskStorageValue = LogicalAddress;
  428. TaskStorageValuePtr = ^TaskStorageValue;
  429. MPSemaphoreCount = ItemCount;
  430. MPSemaphoreCountPtr = ^MPSemaphoreCount;
  431. MPTaskWeight = UInt32;
  432. MPTaskWeightPtr = ^MPTaskWeight;
  433. MPEventFlags = UInt32;
  434. MPEventFlagsPtr = ^MPEventFlags;
  435. MPExceptionKind = UInt32;
  436. MPExceptionKindPtr = ^MPExceptionKind;
  437. MPTaskStateKind = UInt32;
  438. MPTaskStateKindPtr = ^MPTaskStateKind;
  439. MPPageSizeClass = UInt32;
  440. MPPageSizeClassPtr = ^MPPageSizeClass;
  441. const
  442. kDurationImmediate = 0;
  443. kDurationForever = $7FFFFFFF;
  444. kDurationMillisecond = 1;
  445. kDurationMicrosecond = -1;
  446. {
  447. ¤
  448. ===========================================================================================
  449. Process/Processor Services
  450. ==========================
  451. }
  452. {
  453. * MPProcessors() *** DEPRECATED ***
  454. *
  455. * Mac OS X threading:
  456. * Not thread safe
  457. *
  458. * Availability:
  459. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  460. * CarbonLib: in CarbonLib 1.0 and later
  461. * Non-Carbon CFM: in MPLibrary 1.0 and later
  462. }
  463. function MPProcessors: ItemCount; external name '_MPProcessors';
  464. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  465. { The physical total.}
  466. {
  467. * MPProcessorsScheduled() *** DEPRECATED ***
  468. *
  469. * Mac OS X threading:
  470. * Not thread safe
  471. *
  472. * Availability:
  473. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  474. * CarbonLib: in CarbonLib 1.0 and later
  475. * Non-Carbon CFM: in MPLibrary 2.0 and later
  476. }
  477. function MPProcessorsScheduled: ItemCount; external name '_MPProcessorsScheduled';
  478. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  479. { Those currently in use.}
  480. {
  481. ¤
  482. ===========================================================================================
  483. Tasking Services
  484. ================
  485. }
  486. const
  487. { For MPCreateTask options}
  488. kMPCreateTaskSuspendedMask = 1 shl 0; { not supported on Mac OS X}
  489. kMPCreateTaskTakesAllExceptionsMask = 1 shl 1;
  490. kMPCreateTaskNotDebuggableMask = 1 shl 2;
  491. kMPCreateTaskValidOptionsMask = kMPCreateTaskSuspendedMask or kMPCreateTaskTakesAllExceptionsMask or kMPCreateTaskNotDebuggableMask;
  492. { -------------------------------------------------------------------------------------------}
  493. type
  494. TaskProc = function( parameter: UnivPtr ): OSStatus;
  495. {
  496. * MPCreateTask() *** DEPRECATED ***
  497. *
  498. * Mac OS X threading:
  499. * Thread safe
  500. *
  501. * Availability:
  502. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  503. * CarbonLib: in CarbonLib 1.0 and later
  504. * Non-Carbon CFM: in MPLibrary 1.0 and later
  505. }
  506. function MPCreateTask( entryPoint: TaskProc; parameter: UnivPtr; stackSize: ByteCount; notifyQueue: MPQueueID; terminationParameter1: UnivPtr; terminationParameter2: UnivPtr; options: MPTaskOptions; task: MPTaskIDPtr ): OSStatus; external name '_MPCreateTask';
  507. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  508. {
  509. * MPTerminateTask() *** DEPRECATED ***
  510. *
  511. * Mac OS X threading:
  512. * Thread safe
  513. *
  514. * Availability:
  515. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  516. * CarbonLib: in CarbonLib 1.0 and later
  517. * Non-Carbon CFM: in MPLibrary 1.0 and later
  518. }
  519. function MPTerminateTask( task: MPTaskID; terminationStatus: OSStatus ): OSStatus; external name '_MPTerminateTask';
  520. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  521. {
  522. * MPSetTaskWeight() *** DEPRECATED ***
  523. *
  524. * Mac OS X threading:
  525. * Thread safe
  526. *
  527. * Availability:
  528. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  529. * CarbonLib: in CarbonLib 1.0 and later
  530. * Non-Carbon CFM: in MPLibrary 2.0 and later
  531. }
  532. function MPSetTaskWeight( task: MPTaskID; weight: MPTaskWeight ): OSStatus; external name '_MPSetTaskWeight';
  533. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  534. {
  535. * MPTaskIsPreemptive() *** DEPRECATED ***
  536. *
  537. * Mac OS X threading:
  538. * Thread safe
  539. *
  540. * Availability:
  541. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  542. * CarbonLib: in CarbonLib 1.0 and later
  543. * Non-Carbon CFM: in MPLibrary 2.0 and later
  544. }
  545. function MPTaskIsPreemptive( taskID: MPTaskID ): Boolean; external name '_MPTaskIsPreemptive';
  546. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  547. { May be kInvalidID.}
  548. {
  549. * MPExit() *** DEPRECATED ***
  550. *
  551. * Mac OS X threading:
  552. * Thread safe
  553. *
  554. * Availability:
  555. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  556. * CarbonLib: in CarbonLib 1.0 and later
  557. * Non-Carbon CFM: in MPLibrary 1.0 and later
  558. }
  559. procedure MPExit( status: OSStatus ); external name '_MPExit';
  560. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  561. {
  562. * MPYield() *** DEPRECATED ***
  563. *
  564. * Mac OS X threading:
  565. * Thread safe
  566. *
  567. * Availability:
  568. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  569. * CarbonLib: in CarbonLib 1.0 and later
  570. * Non-Carbon CFM: in MPLibrary 1.0 and later
  571. }
  572. procedure MPYield; external name '_MPYield';
  573. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  574. {
  575. * MPCurrentTaskID() *** DEPRECATED ***
  576. *
  577. * Mac OS X threading:
  578. * Thread safe
  579. *
  580. * Availability:
  581. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  582. * CarbonLib: in CarbonLib 1.0 and later
  583. * Non-Carbon CFM: in MPLibrary 1.0 and later
  584. }
  585. function MPCurrentTaskID: MPTaskID; external name '_MPCurrentTaskID';
  586. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  587. {
  588. * MPSetTaskType()
  589. *
  590. * Mac OS X threading:
  591. * Thread safe
  592. *
  593. * Availability:
  594. * Mac OS X: in version 10.1 and later in CoreServices.framework
  595. * CarbonLib: in CarbonLib 1.0 and later
  596. * Non-Carbon CFM: in MPLibrary 2.3 and later
  597. }
  598. function MPSetTaskType( task: MPTaskID; taskType: OSType ): OSStatus; external name '_MPSetTaskType';
  599. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_8, __IPHONE_NA, __IPHONE_NA) *)
  600. { -------------------------------------------------------------------------------------------}
  601. {
  602. ---------------------------------------------------
  603. ! The task storage services are new in version 2.0.
  604. }
  605. {
  606. * MPAllocateTaskStorageIndex() *** DEPRECATED ***
  607. *
  608. * Mac OS X threading:
  609. * Thread safe
  610. *
  611. * Availability:
  612. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  613. * CarbonLib: in CarbonLib 1.0 and later
  614. * Non-Carbon CFM: in MPLibrary 2.0 and later
  615. }
  616. function MPAllocateTaskStorageIndex( var taskIndex: TaskStorageIndex ): OSStatus; external name '_MPAllocateTaskStorageIndex';
  617. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  618. {
  619. * MPDeallocateTaskStorageIndex() *** DEPRECATED ***
  620. *
  621. * Mac OS X threading:
  622. * Thread safe
  623. *
  624. * Availability:
  625. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  626. * CarbonLib: in CarbonLib 1.0 and later
  627. * Non-Carbon CFM: in MPLibrary 2.0 and later
  628. }
  629. function MPDeallocateTaskStorageIndex( taskIndex: TaskStorageIndex ): OSStatus; external name '_MPDeallocateTaskStorageIndex';
  630. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  631. {
  632. * MPSetTaskStorageValue() *** DEPRECATED ***
  633. *
  634. * Mac OS X threading:
  635. * Thread safe
  636. *
  637. * Availability:
  638. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  639. * CarbonLib: in CarbonLib 1.0 and later
  640. * Non-Carbon CFM: in MPLibrary 2.0 and later
  641. }
  642. function MPSetTaskStorageValue( taskIndex: TaskStorageIndex; value: TaskStorageValue ): OSStatus; external name '_MPSetTaskStorageValue';
  643. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  644. {
  645. * MPGetTaskStorageValue() *** DEPRECATED ***
  646. *
  647. * Mac OS X threading:
  648. * Thread safe
  649. *
  650. * Availability:
  651. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  652. * CarbonLib: in CarbonLib 1.0 and later
  653. * Non-Carbon CFM: in MPLibrary 2.0 and later
  654. }
  655. function MPGetTaskStorageValue( taskIndex: TaskStorageIndex ): TaskStorageValue; external name '_MPGetTaskStorageValue';
  656. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  657. {
  658. ¤
  659. ===========================================================================================
  660. Synchronization Services
  661. ========================
  662. }
  663. {
  664. * MPCreateQueue() *** DEPRECATED ***
  665. *
  666. * Mac OS X threading:
  667. * Thread safe
  668. *
  669. * Availability:
  670. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  671. * CarbonLib: in CarbonLib 1.0 and later
  672. * Non-Carbon CFM: in MPLibrary 1.0 and later
  673. }
  674. function MPCreateQueue( var queue: MPQueueID ): OSStatus; external name '_MPCreateQueue';
  675. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  676. {
  677. * MPDeleteQueue() *** DEPRECATED ***
  678. *
  679. * Mac OS X threading:
  680. * Thread safe
  681. *
  682. * Availability:
  683. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  684. * CarbonLib: in CarbonLib 1.0 and later
  685. * Non-Carbon CFM: in MPLibrary 1.0 and later
  686. }
  687. function MPDeleteQueue( queue: MPQueueID ): OSStatus; external name '_MPDeleteQueue';
  688. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  689. {
  690. * MPNotifyQueue() *** DEPRECATED ***
  691. *
  692. * Mac OS X threading:
  693. * Thread safe
  694. *
  695. * Availability:
  696. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  697. * CarbonLib: in CarbonLib 1.0 and later
  698. * Non-Carbon CFM: in MPLibrary 1.0 and later
  699. }
  700. function MPNotifyQueue( queue: MPQueueID; param1: UnivPtr; param2: UnivPtr; param3: UnivPtr ): OSStatus; external name '_MPNotifyQueue';
  701. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  702. {
  703. * MPWaitOnQueue() *** DEPRECATED ***
  704. *
  705. * Mac OS X threading:
  706. * Thread safe
  707. *
  708. * Availability:
  709. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  710. * CarbonLib: in CarbonLib 1.0 and later
  711. * Non-Carbon CFM: in MPLibrary 1.0 and later
  712. }
  713. function MPWaitOnQueue( queue: MPQueueID; var param1: UnivPtr; var param2: UnivPtr; var param3: UnivPtr; timeout: Duration ): OSStatus; external name '_MPWaitOnQueue';
  714. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  715. {
  716. * MPSetQueueReserve() *** DEPRECATED ***
  717. *
  718. * Mac OS X threading:
  719. * Thread safe
  720. *
  721. * Availability:
  722. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  723. * CarbonLib: in CarbonLib 1.0 and later
  724. * Non-Carbon CFM: in MPLibrary 2.0 and later
  725. }
  726. function MPSetQueueReserve( queue: MPQueueID; count: ItemCount ): OSStatus; external name '_MPSetQueueReserve';
  727. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  728. { -------------------------------------------------------------------------------------------}
  729. {
  730. * MPCreateSemaphore() *** DEPRECATED ***
  731. *
  732. * Mac OS X threading:
  733. * Thread safe
  734. *
  735. * Availability:
  736. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  737. * CarbonLib: in CarbonLib 1.0 and later
  738. * Non-Carbon CFM: in MPLibrary 1.0 and later
  739. }
  740. function MPCreateSemaphore( maximumValue: MPSemaphoreCount; initialValue: MPSemaphoreCount; var semaphore: MPSemaphoreID ): OSStatus; external name '_MPCreateSemaphore';
  741. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  742. {
  743. * MPDeleteSemaphore() *** DEPRECATED ***
  744. *
  745. * Mac OS X threading:
  746. * Thread safe
  747. *
  748. * Availability:
  749. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  750. * CarbonLib: in CarbonLib 1.0 and later
  751. * Non-Carbon CFM: in MPLibrary 1.0 and later
  752. }
  753. function MPDeleteSemaphore( semaphore: MPSemaphoreID ): OSStatus; external name '_MPDeleteSemaphore';
  754. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  755. {
  756. * MPSignalSemaphore() *** DEPRECATED ***
  757. *
  758. * Mac OS X threading:
  759. * Thread safe
  760. *
  761. * Availability:
  762. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  763. * CarbonLib: in CarbonLib 1.0 and later
  764. * Non-Carbon CFM: in MPLibrary 1.0 and later
  765. }
  766. function MPSignalSemaphore( semaphore: MPSemaphoreID ): OSStatus; external name '_MPSignalSemaphore';
  767. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  768. {
  769. * MPWaitOnSemaphore() *** DEPRECATED ***
  770. *
  771. * Mac OS X threading:
  772. * Thread safe
  773. *
  774. * Availability:
  775. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  776. * CarbonLib: in CarbonLib 1.0 and later
  777. * Non-Carbon CFM: in MPLibrary 1.0 and later
  778. }
  779. function MPWaitOnSemaphore( semaphore: MPSemaphoreID; timeout: Duration ): OSStatus; external name '_MPWaitOnSemaphore';
  780. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  781. { -------------------------------------------------------------------------------------------}
  782. {
  783. * MPCreateCriticalRegion() *** DEPRECATED ***
  784. *
  785. * Mac OS X threading:
  786. * Thread safe
  787. *
  788. * Availability:
  789. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  790. * CarbonLib: in CarbonLib 1.0 and later
  791. * Non-Carbon CFM: in MPLibrary 1.0 and later
  792. }
  793. function MPCreateCriticalRegion( var criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPCreateCriticalRegion';
  794. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  795. {
  796. * MPDeleteCriticalRegion() *** DEPRECATED ***
  797. *
  798. * Mac OS X threading:
  799. * Thread safe
  800. *
  801. * Availability:
  802. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  803. * CarbonLib: in CarbonLib 1.0 and later
  804. * Non-Carbon CFM: in MPLibrary 1.0 and later
  805. }
  806. function MPDeleteCriticalRegion( criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPDeleteCriticalRegion';
  807. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  808. {
  809. * MPEnterCriticalRegion() *** DEPRECATED ***
  810. *
  811. * Mac OS X threading:
  812. * Thread safe
  813. *
  814. * Availability:
  815. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  816. * CarbonLib: in CarbonLib 1.0 and later
  817. * Non-Carbon CFM: in MPLibrary 1.0 and later
  818. }
  819. function MPEnterCriticalRegion( criticalRegion: MPCriticalRegionID; timeout: Duration ): OSStatus; external name '_MPEnterCriticalRegion';
  820. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  821. {
  822. * MPExitCriticalRegion() *** DEPRECATED ***
  823. *
  824. * Mac OS X threading:
  825. * Thread safe
  826. *
  827. * Availability:
  828. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  829. * CarbonLib: in CarbonLib 1.0 and later
  830. * Non-Carbon CFM: in MPLibrary 1.0 and later
  831. }
  832. function MPExitCriticalRegion( criticalRegion: MPCriticalRegionID ): OSStatus; external name '_MPExitCriticalRegion';
  833. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  834. { -------------------------------------------------------------------------------------------}
  835. {
  836. * MPCreateEvent() *** DEPRECATED ***
  837. *
  838. * Mac OS X threading:
  839. * Thread safe
  840. *
  841. * Availability:
  842. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  843. * CarbonLib: in CarbonLib 1.0 and later
  844. * Non-Carbon CFM: in MPLibrary 2.0 and later
  845. }
  846. function MPCreateEvent( var event: MPEventID ): OSStatus; external name '_MPCreateEvent';
  847. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  848. {
  849. * MPDeleteEvent() *** DEPRECATED ***
  850. *
  851. * Mac OS X threading:
  852. * Thread safe
  853. *
  854. * Availability:
  855. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  856. * CarbonLib: in CarbonLib 1.0 and later
  857. * Non-Carbon CFM: in MPLibrary 2.0 and later
  858. }
  859. function MPDeleteEvent( event: MPEventID ): OSStatus; external name '_MPDeleteEvent';
  860. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  861. {
  862. * MPSetEvent() *** DEPRECATED ***
  863. *
  864. * Mac OS X threading:
  865. * Thread safe
  866. *
  867. * Availability:
  868. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  869. * CarbonLib: in CarbonLib 1.0 and later
  870. * Non-Carbon CFM: in MPLibrary 2.0 and later
  871. }
  872. function MPSetEvent( event: MPEventID; flags: MPEventFlags ): OSStatus; external name '_MPSetEvent';
  873. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  874. {
  875. * MPWaitForEvent() *** DEPRECATED ***
  876. *
  877. * Mac OS X threading:
  878. * Thread safe
  879. *
  880. * Availability:
  881. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  882. * CarbonLib: in CarbonLib 1.0 and later
  883. * Non-Carbon CFM: in MPLibrary 2.0 and later
  884. }
  885. function MPWaitForEvent( event: MPEventID; flags: MPEventFlagsPtr; timeout: Duration ): OSStatus; external name '_MPWaitForEvent';
  886. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  887. {
  888. ¤
  889. ===========================================================================================
  890. Notification Services (API)
  891. =====================
  892. }
  893. {
  894. * MPCreateNotification()
  895. *
  896. * Mac OS X threading:
  897. * Thread safe
  898. *
  899. * Availability:
  900. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  901. * CarbonLib: in CarbonLib 1.0 and later
  902. * Non-Carbon CFM: in MPLibrary 2.1 and later
  903. }
  904. function MPCreateNotification( var notificationID: MPNotificationID ): OSStatus; external name '_MPCreateNotification';
  905. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  906. {
  907. * MPDeleteNotification() *** DEPRECATED ***
  908. *
  909. * Mac OS X threading:
  910. * Thread safe
  911. *
  912. * Availability:
  913. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  914. * CarbonLib: in CarbonLib 1.0 and later
  915. * Non-Carbon CFM: in MPLibrary 2.1 and later
  916. }
  917. function MPDeleteNotification( notificationID: MPNotificationID ): OSStatus; external name '_MPDeleteNotification';
  918. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  919. {
  920. * MPModifyNotification() *** DEPRECATED ***
  921. *
  922. * Mac OS X threading:
  923. * Thread safe
  924. *
  925. * Availability:
  926. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  927. * CarbonLib: in CarbonLib 1.0 and later
  928. * Non-Carbon CFM: in MPLibrary 2.1 and later
  929. }
  930. function MPModifyNotification( notificationID: MPNotificationID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPModifyNotification';
  931. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  932. {
  933. * MPModifyNotificationParameters() *** DEPRECATED ***
  934. *
  935. * Mac OS X threading:
  936. * Thread safe
  937. *
  938. * Availability:
  939. * Mac OS X: in version 10.1 and later in CoreServices.framework but deprecated in 10.7
  940. * CarbonLib: in CarbonLib 1.0 and later
  941. * Non-Carbon CFM: in MPLibrary 2.3 and later
  942. }
  943. function MPModifyNotificationParameters( notificationID: MPNotificationID; kind: MPOpaqueIDClass; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPModifyNotificationParameters';
  944. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_1, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  945. {
  946. * MPCauseNotification() *** DEPRECATED ***
  947. *
  948. * Mac OS X threading:
  949. * Thread safe
  950. *
  951. * Availability:
  952. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  953. * CarbonLib: in CarbonLib 1.0 and later
  954. * Non-Carbon CFM: in MPLibrary 2.1 and later
  955. }
  956. function MPCauseNotification( notificationID: MPNotificationID ): OSStatus; external name '_MPCauseNotification';
  957. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  958. {
  959. ¤
  960. ===========================================================================================
  961. Timer Services
  962. ==============
  963. }
  964. {
  965. --------------------------------------------
  966. ! The timer services are new in version 2.0.
  967. }
  968. const
  969. { For MPArmTimer options}
  970. kMPPreserveTimerIDMask = 1 shl 0;
  971. kMPTimeIsDeltaMask = 1 shl 1;
  972. kMPTimeIsDurationMask = 1 shl 2;
  973. {
  974. * MPDelayUntil() *** DEPRECATED ***
  975. *
  976. * Mac OS X threading:
  977. * Thread safe
  978. *
  979. * Availability:
  980. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  981. * CarbonLib: in CarbonLib 1.0 and later
  982. * Non-Carbon CFM: in MPLibrary 2.0 and later
  983. }
  984. function MPDelayUntil( var expirationTime: AbsoluteTime ): OSStatus; external name '_MPDelayUntil';
  985. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  986. {
  987. * MPDelayUntilSys()
  988. *
  989. * Availability:
  990. * Mac OS X: not available
  991. * CarbonLib: not available
  992. * Non-Carbon CFM: in MPLibrary 2.1 and later
  993. }
  994. {
  995. * MPCreateTimer() *** DEPRECATED ***
  996. *
  997. * Mac OS X threading:
  998. * Thread safe
  999. *
  1000. * Availability:
  1001. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1002. * CarbonLib: in CarbonLib 1.0 and later
  1003. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1004. }
  1005. function MPCreateTimer( var timerID: MPTimerID ): OSStatus; external name '_MPCreateTimer';
  1006. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1007. {
  1008. * MPDeleteTimer() *** DEPRECATED ***
  1009. *
  1010. * Mac OS X threading:
  1011. * Thread safe
  1012. *
  1013. * Availability:
  1014. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1015. * CarbonLib: in CarbonLib 1.0 and later
  1016. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1017. }
  1018. function MPDeleteTimer( timerID: MPTimerID ): OSStatus; external name '_MPDeleteTimer';
  1019. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1020. {
  1021. * MPSetTimerNotify() *** DEPRECATED ***
  1022. *
  1023. * Mac OS X threading:
  1024. * Thread safe
  1025. *
  1026. * Availability:
  1027. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1028. * CarbonLib: in CarbonLib 1.0 and later
  1029. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1030. }
  1031. function MPSetTimerNotify( timerID: MPTimerID; anID: MPOpaqueID; notifyParam1: UnivPtr; notifyParam2: UnivPtr; notifyParam3: UnivPtr ): OSStatus; external name '_MPSetTimerNotify';
  1032. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1033. {
  1034. * MPArmTimer() *** DEPRECATED ***
  1035. *
  1036. * Mac OS X threading:
  1037. * Thread safe
  1038. *
  1039. * Availability:
  1040. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1041. * CarbonLib: in CarbonLib 1.0 and later
  1042. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1043. }
  1044. function MPArmTimer( timerID: MPTimerID; var expirationTime: AbsoluteTime; options: OptionBits ): OSStatus; external name '_MPArmTimer';
  1045. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1046. {
  1047. * MPCancelTimer() *** DEPRECATED ***
  1048. *
  1049. * Mac OS X threading:
  1050. * Thread safe
  1051. *
  1052. * Availability:
  1053. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1054. * CarbonLib: in CarbonLib 1.0 and later
  1055. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1056. }
  1057. function MPCancelTimer( timerID: MPTimerID; timeRemaining: AbsoluteTimePtr ): OSStatus; external name '_MPCancelTimer';
  1058. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1059. {
  1060. ¤
  1061. ===========================================================================================
  1062. Memory Services
  1063. ===============
  1064. }
  1065. const
  1066. { Maximum allocation request size is 1GB.}
  1067. kMPMaxAllocSize = 1073741824;
  1068. const
  1069. { Values for the alignment parameter to MPAllocateAligned.}
  1070. kMPAllocateDefaultAligned = 0;
  1071. kMPAllocate8ByteAligned = 3;
  1072. kMPAllocate16ByteAligned = 4;
  1073. kMPAllocate32ByteAligned = 5;
  1074. kMPAllocate1024ByteAligned = 10;
  1075. kMPAllocate4096ByteAligned = 12;
  1076. kMPAllocateMaxAlignment = 16; { Somewhat arbitrary limit on expectations.}
  1077. kMPAllocateAltiVecAligned = kMPAllocate16ByteAligned; { The P.C. name.}
  1078. kMPAllocateVMXAligned = kMPAllocateAltiVecAligned; { The older, common name.}
  1079. kMPAllocateVMPageAligned = 254; { Pseudo value, converted at runtime.}
  1080. kMPAllocateInterlockAligned = 255; { Pseudo value, converted at runtime.}
  1081. const
  1082. { Values for the options parameter to MPAllocateAligned.}
  1083. kMPAllocateClearMask = $0001; { Zero the allocated block.}
  1084. kMPAllocateGloballyMask = $0002; { Allocate from the globally visible pool.}
  1085. kMPAllocateResidentMask = $0004; { Allocate from the RAM-resident pool.}
  1086. kMPAllocateNoGrowthMask = $0010; { Do not attempt to grow the pool.}
  1087. kMPAllocateNoCreateMask = $0020; { Do not attempt to create the pool if it doesn't exist yet.}
  1088. { -------------------------------------------------------------------------------------------}
  1089. {
  1090. * MPAllocateAligned() *** DEPRECATED ***
  1091. *
  1092. * Mac OS X threading:
  1093. * Thread safe
  1094. *
  1095. * Availability:
  1096. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1097. * CarbonLib: in CarbonLib 1.0 and later
  1098. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1099. }
  1100. function MPAllocateAligned( size: ByteCount; alignment: UInt8; options: OptionBits ): LogicalAddress; external name '_MPAllocateAligned';
  1101. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1102. { ! MPAllocateAligned is new in version 2.0.}
  1103. {
  1104. * MPAllocate() *** DEPRECATED ***
  1105. *
  1106. * Mac OS X threading:
  1107. * Thread safe
  1108. *
  1109. * Availability:
  1110. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1111. * CarbonLib: in CarbonLib 1.0 and later
  1112. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1113. }
  1114. function MPAllocate( size: ByteCount ): LogicalAddress; external name '_MPAllocate';
  1115. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1116. { Use MPAllocateAligned instead.}
  1117. {
  1118. * MPFree() *** DEPRECATED ***
  1119. *
  1120. * Mac OS X threading:
  1121. * Thread safe
  1122. *
  1123. * Availability:
  1124. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1125. * CarbonLib: in CarbonLib 1.0 and later
  1126. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1127. }
  1128. procedure MPFree( objct: LogicalAddress ); external name '_MPFree';
  1129. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1130. {
  1131. * MPGetAllocatedBlockSize() *** DEPRECATED ***
  1132. *
  1133. * Mac OS X threading:
  1134. * Thread safe
  1135. *
  1136. * Availability:
  1137. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1138. * CarbonLib: in CarbonLib 1.0 and later
  1139. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1140. }
  1141. function MPGetAllocatedBlockSize( objct: LogicalAddress ): ByteCount; external name '_MPGetAllocatedBlockSize';
  1142. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1143. { -------------------------------------------------------------------------------------------}
  1144. {
  1145. * MPBlockCopy() *** DEPRECATED ***
  1146. *
  1147. * Mac OS X threading:
  1148. * Thread safe
  1149. *
  1150. * Availability:
  1151. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1152. * CarbonLib: in CarbonLib 1.0 and later
  1153. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1154. }
  1155. procedure MPBlockCopy( source: LogicalAddress; destination: LogicalAddress; size: ByteCount ); external name '_MPBlockCopy';
  1156. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1157. {
  1158. * MPBlockClear() *** DEPRECATED ***
  1159. *
  1160. * Mac OS X threading:
  1161. * Thread safe
  1162. *
  1163. * Availability:
  1164. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1165. * CarbonLib: in CarbonLib 1.0 and later
  1166. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1167. }
  1168. procedure MPBlockClear( address: LogicalAddress; size: ByteCount ); external name '_MPBlockClear';
  1169. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1170. {$ifc not TARGET_CPU_64}
  1171. {
  1172. * MPDataToCode() *** DEPRECATED ***
  1173. *
  1174. * Mac OS X threading:
  1175. * Thread safe
  1176. *
  1177. * Availability:
  1178. * Mac OS X: in version 10.0 and later in CoreServices.framework [32-bit only] but deprecated in 10.7
  1179. * CarbonLib: in CarbonLib 1.0 and later
  1180. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1181. }
  1182. procedure MPDataToCode( address: LogicalAddress; size: ByteCount ); external name '_MPDataToCode';
  1183. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1184. { NOTE: MPDataToCode is not supported for 64-bit applications. Use mprotect(2) instead.}
  1185. {
  1186. ¤
  1187. ===========================================================================================
  1188. Exception/Debugging Services
  1189. ============================
  1190. }
  1191. {
  1192. -------------------------------------------------------------------------------------------
  1193. *** Important Note ***
  1194. ----------------------
  1195. The functions MPExtractTaskState and MPSetTaskState infer the size of the "info" buffer
  1196. from the "kind" parameter. A given value for MPTaskStateKind will always refer to a
  1197. single specific physical buffer layout. Should new register sets be added, or the size
  1198. or number of any registers change, new values of MPTaskStateKind will be introduced to
  1199. refer to the new buffer layouts.
  1200. The following types for the buffers are in MachineExceptions. The correspondence between
  1201. MPTaskStateKind values and MachineExceptions types is:
  1202. kMPTaskStateRegisters -> RegisterInformation
  1203. kMPTaskStateFPU -> FPUInformation
  1204. kMPTaskStateVectors -> VectorInformation
  1205. kMPTaskStateMachine -> MachineInformation
  1206. kMPTaskState32BitMemoryException -> ExceptionInfo for old-style 32-bit memory exceptions
  1207. For reference, on PowerPC the MachineExceptions types contain:
  1208. RegisterInformation -> The GPRs, 32 values of 64 bits each.
  1209. FPUInformation -> The FPRs plus FPSCR, 32 values of 64 bits each, one value of
  1210. 32 bits.
  1211. VectorInformation -> The AltiVec vector registers plus VSCR and VRSave, 32 values
  1212. of 128 bits each, one value of 128 bits, and one 32 bit value.
  1213. MachineInformation -> The CTR, LR, PC, each of 64 bits. The CR, XER, MSR, MQ,
  1214. exception kind, and DSISR, each of 32 bits. The 64 bit DAR.
  1215. ExceptionInfo -> Only memory exceptions are specified, 4 fields of 32 bits each.
  1216. Note that this type only covers memory exceptions on 32-bit CPUs!
  1217. The following types are declared here:
  1218. kMPTaskStateTaskInfo -> MPTaskInfo
  1219. }
  1220. {$endc} {not TARGET_CPU_64}
  1221. const
  1222. { Values for the TaskStateKind to MPExtractTaskState and MPSetTaskState.}
  1223. kMPTaskStateRegisters = 0; { The task general registers.}
  1224. kMPTaskStateFPU = 1; { The task floating point registers}
  1225. kMPTaskStateVectors = 2; { The task vector registers}
  1226. kMPTaskStateMachine = 3; { The task machine registers}
  1227. kMPTaskState32BitMemoryException = 4; { The task memory exception information for 32-bit CPUs.}
  1228. kMPTaskStateTaskInfo = 5; { Static and dynamic information about the task.}
  1229. const
  1230. { Option bits and numbers for MPDisposeTaskException.}
  1231. kMPTaskPropagate = 0; { The exception is propagated.}
  1232. kMPTaskResumeStep = 1; { The task is resumed and single step is enabled.}
  1233. kMPTaskResumeBranch = 2; { The task is resumed and branch stepping is enabled.}
  1234. kMPTaskResumeMask = $0000; { The task is resumed.}
  1235. kMPTaskPropagateMask = 1 shl kMPTaskPropagate; { The exception is propagated.}
  1236. kMPTaskResumeStepMask = 1 shl kMPTaskResumeStep; { The task is resumed and single step is enabled.}
  1237. kMPTaskResumeBranchMask = 1 shl kMPTaskResumeBranch; { The task is resumed and branch stepping is enabled.}
  1238. const
  1239. { For kMPTaskStateTaskInfo, the task's runState}
  1240. kMPTaskBlocked = 0; { Task is blocked (queued on resource)}
  1241. kMPTaskReady = 1; { Task is runnable}
  1242. kMPTaskRunning = 2; { Task is running}
  1243. const
  1244. { For kMPTaskStateTaskInfo, the version of the MPTaskInfo structure requested.}
  1245. kMPTaskInfoVersion = 3;
  1246. type
  1247. MPTaskInfoVersion2Ptr = ^MPTaskInfoVersion2;
  1248. MPTaskInfoVersion2 = record
  1249. version: PBVersion; { Version 2 of the data structure requested}
  1250. name: OSType; { Task name}
  1251. queueName: OSType; { Task's queue owner name}
  1252. runState: UInt16; { Running, ready, blocked}
  1253. lastCPU: UInt16; { Address of CPU where task previously ran}
  1254. weight: UInt32; { Processing weight: 1 - 10,000}
  1255. processID: MPProcessID; { Owning process ID}
  1256. cpuTime: AbsoluteTime; { Accumulated task time}
  1257. schedTime: AbsoluteTime; { Time when last scheduled}
  1258. creationTime: AbsoluteTime; { Time when task created}
  1259. codePageFaults: ItemCount; { Page faults from code execution}
  1260. dataPageFaults: ItemCount; { Page faults from data access}
  1261. preemptions: ItemCount; { Number of times task was preempted}
  1262. cpuID: MPCpuID; { ID of CPU where task previously ran}
  1263. end;
  1264. type
  1265. MPTaskInfoPtr = ^MPTaskInfo;
  1266. MPTaskInfo = record
  1267. version: PBVersion; { Version 3 of the data structure requested}
  1268. name: OSType; { Task name}
  1269. queueName: OSType; { Task's queue owner name}
  1270. runState: UInt16; { Running, ready, blocked}
  1271. lastCPU: UInt16; { Address of CPU where task previously ran}
  1272. weight: UInt32; { Processing weight: 1 - 10,000}
  1273. processID: MPProcessID; { Owning process ID}
  1274. cpuTime: AbsoluteTime; { Accumulated task time}
  1275. schedTime: AbsoluteTime; { Time when last scheduled}
  1276. creationTime: AbsoluteTime; { Time when task created}
  1277. codePageFaults: ItemCount; { Page faults from code execution}
  1278. dataPageFaults: ItemCount; { Page faults from data access}
  1279. preemptions: ItemCount; { Number of times task was preempted}
  1280. cpuID: MPCpuID; { ID of CPU where task previously ran.}
  1281. blockedObject: MPOpaqueID; { ID of blocked object.}
  1282. spaceID: MPAddressSpaceID; { Address space ID of this task.}
  1283. stackBase: LogicalAddress; { Base of stack (lowest address).}
  1284. stackLimit: LogicalAddress; { Stack limit (highest address).}
  1285. stackCurr: LogicalAddress; { Current stack address.}
  1286. end;
  1287. {
  1288. Upon a task exception, the following message is sent to the designated queue:
  1289. 1. The MPTaskID,
  1290. 2. The exception kind. These are enumerated in the interfaces header MachineExceptions.h
  1291. 3. N/A
  1292. }
  1293. { -------------------------------------------------------------------------------------------}
  1294. {
  1295. * MPSetExceptionHandler() *** DEPRECATED ***
  1296. *
  1297. * Mac OS X threading:
  1298. * Thread safe
  1299. *
  1300. * Availability:
  1301. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1302. * CarbonLib: in CarbonLib 1.0 and later
  1303. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1304. }
  1305. function MPSetExceptionHandler( task: MPTaskID; exceptionQ: MPQueueID ): OSStatus; external name '_MPSetExceptionHandler';
  1306. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1307. {
  1308. * MPDisposeTaskException() *** DEPRECATED ***
  1309. *
  1310. * Mac OS X threading:
  1311. * Thread safe
  1312. *
  1313. * Availability:
  1314. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1315. * CarbonLib: in CarbonLib 1.0 and later
  1316. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1317. }
  1318. function MPDisposeTaskException( task: MPTaskID; action: OptionBits ): OSStatus; external name '_MPDisposeTaskException';
  1319. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1320. {
  1321. * MPExtractTaskState() *** DEPRECATED ***
  1322. *
  1323. * Mac OS X threading:
  1324. * Thread safe
  1325. *
  1326. * Availability:
  1327. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1328. * CarbonLib: in CarbonLib 1.0 and later
  1329. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1330. }
  1331. function MPExtractTaskState( task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr ): OSStatus; external name '_MPExtractTaskState';
  1332. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1333. {
  1334. * MPSetTaskState() *** DEPRECATED ***
  1335. *
  1336. * Mac OS X threading:
  1337. * Thread safe
  1338. *
  1339. * Availability:
  1340. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1341. * CarbonLib: in CarbonLib 1.0 and later
  1342. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1343. }
  1344. function MPSetTaskState( task: MPTaskID; kind: MPTaskStateKind; info: UnivPtr ): OSStatus; external name '_MPSetTaskState';
  1345. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1346. {
  1347. * MPThrowException() *** DEPRECATED ***
  1348. *
  1349. * Mac OS X threading:
  1350. * Thread safe
  1351. *
  1352. * Availability:
  1353. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1354. * CarbonLib: in CarbonLib 1.0 and later
  1355. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1356. }
  1357. function MPThrowException( task: MPTaskID; kind: MPExceptionKind ): OSStatus; external name '_MPThrowException';
  1358. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1359. { -------------------------------------------------------------------------------------------}
  1360. type
  1361. MPDebuggerLevel = UInt32;
  1362. const
  1363. kMPLowLevelDebugger = $00000000; { MacsBug-like}
  1364. kMPMidLevelDebugger = $10000000; { Jasik-like}
  1365. kMPHighLevelDebugger = $20000000; { Metrowerks-like}
  1366. {
  1367. * MPRegisterDebugger() *** DEPRECATED ***
  1368. *
  1369. * Mac OS X threading:
  1370. * Thread safe
  1371. *
  1372. * Availability:
  1373. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1374. * CarbonLib: in CarbonLib 1.0 and later
  1375. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1376. }
  1377. function MPRegisterDebugger( queue: MPQueueID; level: MPDebuggerLevel ): OSStatus; external name '_MPRegisterDebugger';
  1378. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1379. {
  1380. * MPUnregisterDebugger() *** DEPRECATED ***
  1381. *
  1382. * Mac OS X threading:
  1383. * Thread safe
  1384. *
  1385. * Availability:
  1386. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1387. * CarbonLib: in CarbonLib 1.0 and later
  1388. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1389. }
  1390. function MPUnregisterDebugger( queue: MPQueueID ): OSStatus; external name '_MPUnregisterDebugger';
  1391. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1392. {
  1393. ¤
  1394. ===========================================================================================
  1395. Remote Call Services
  1396. ====================
  1397. }
  1398. type
  1399. MPRemoteProcedure = function( parameter: UnivPtr ): UnivPtr;
  1400. type
  1401. MPRemoteContext = UInt8;
  1402. const
  1403. kMPAnyRemoteContext = 0;
  1404. kMPOwningProcessRemoteContext = 1;
  1405. kMPInterruptRemoteContext = 2;
  1406. kMPAsyncInterruptRemoteContext = 3;
  1407. {
  1408. * MPRemoteCall() *** DEPRECATED ***
  1409. *
  1410. * Summary:
  1411. * Calls a nonreentrant function and blocks the current task.
  1412. *
  1413. * Discussion:
  1414. * You use this function primarily to indirectly execute Mac OS
  1415. * system software functions. The task making the remote call is
  1416. * blocked until the call completes. The amount of time taken to
  1417. * schedule the remote procedure depends on the choice of the
  1418. * designated operating context. Specifying kMPAnyRemoteContext
  1419. * offers the lowest latency, but the called procedure may not have
  1420. * access to process-specific resources such as some low-memory
  1421. * values. Specifying kMPOwningProcessRemoteContext has higher
  1422. * latency because the remote procedure is deferred until the owning
  1423. * process becomes active. However, the remote procedure is
  1424. * guaranteed to execute within the owning process. Note that with
  1425. * the exception of functions in Multiprocessing Services, you
  1426. * cannot safely call any system software functions directly from a
  1427. * preemptive task. Even if some system software function appears to
  1428. * work today when called from a preemptive task, unless explicitly
  1429. * stated otherwise there is no guarantee that subsequent versions
  1430. * of the same function will continue to work in future versions of
  1431. * system software. In Mac OS 8 implementations of Multiprocessing
  1432. * Services, the only exceptions to this rule are the atomic memory
  1433. * operations (such as AddAtomic ) exported in the InterfaceLib
  1434. * shared library. Even these functions may switch to 68K mode if
  1435. * the operands to them are not aligned. If you need to access
  1436. * system software functions from a preemptive task, you must do so
  1437. * using the MPRemoteCall function. %% @deprecated Use blocks to
  1438. * make a call on anothed dispatch queue() and block on the result.
  1439. *
  1440. * Mac OS X threading:
  1441. * Thread safe
  1442. *
  1443. * Parameters:
  1444. *
  1445. * remoteProc:
  1446. * A pointer of type MPRemoteProcedure that references the
  1447. * application-defined function you want to call. See
  1448. * MyRemoteProcedure for more information about the form of this
  1449. * function.
  1450. *
  1451. * parameter:
  1452. * A pointer to a parameter to pass to the application-defined
  1453. * function. For example, this value could point to a data
  1454. * structure or a memory location.
  1455. *
  1456. * context:
  1457. * A value of type MPRemoteContext that specifies which contexts
  1458. * (that is processes) are allowed to execute the function. See
  1459. * ÒRemote Call Context Option ConstantsÓ for a list of possible
  1460. * values.
  1461. *
  1462. * Availability:
  1463. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1464. * CarbonLib: in CarbonLib 1.0 and later
  1465. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1466. }
  1467. function MPRemoteCall( remoteProc: MPRemoteProcedure; parameter: UnivPtr; context: MPRemoteContext ): UnivPtr; external name '_MPRemoteCall';
  1468. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1469. {
  1470. * MPRemoteCallCFM() *** DEPRECATED ***
  1471. *
  1472. * Deprecated:
  1473. * No longer applicable now that the Multiprocessing Utilities have
  1474. * been deprecated.
  1475. *
  1476. * Summary:
  1477. * Calls a nonreentrant function and blocks the current task.
  1478. *
  1479. * Discussion:
  1480. * You use this function primarily to indirectly execute Mac OS
  1481. * system software functions. The task making the remote call is
  1482. * blocked until the call completes. The amount of time taken to
  1483. * schedule the remote procedure depends on the choice of the
  1484. * designated operating context. Specifying kMPAnyRemoteContext
  1485. * offers the lowest latency, but the called procedure may not have
  1486. * access to process-specific resources such as some low-memory
  1487. * values. Specifying kMPOwningProcessRemoteContext has higher
  1488. * latency because the remote procedure is deferred until the owning
  1489. * process becomes active. However, the remote procedure is
  1490. * guaranteed to execute within the owning process. Note that with
  1491. * the exception of functions in Multiprocessing Services, you
  1492. * cannot safely call any system software functions directly from a
  1493. * preemptive task. Even if some system software function appears to
  1494. * work today when called from a preemptive task, unless explicitly
  1495. * stated otherwise there is no guarantee that subsequent versions
  1496. * of the same function will continue to work in future versions of
  1497. * system software.
  1498. *
  1499. * Mac OS X threading:
  1500. * Thread safe
  1501. *
  1502. * Parameters:
  1503. *
  1504. * remoteProc:
  1505. * A pointer of type MPRemoteProcedure to a CFM function that
  1506. * references the application-defined function you want to call.
  1507. * See MyRemoteProcedure for more information about the form of
  1508. * this function.
  1509. *
  1510. * parameter:
  1511. * A pointer to a parameter to pass to the application-defined
  1512. * function. For example, this value could point to a data
  1513. * structure or a memory location.
  1514. *
  1515. * context:
  1516. * A value of type MPRemoteContext that specifies which contexts
  1517. * (that is processes) are allowed to execute the function. See
  1518. * ÒRemote Call Context Option ConstantsÓ for a list of possible
  1519. * values.
  1520. *
  1521. * Availability:
  1522. * Mac OS X: in version 10.4 and later in CoreServices.framework but deprecated in 10.7
  1523. * CarbonLib: not available
  1524. * Non-Carbon CFM: in MPLibrary 2.0 and later
  1525. }
  1526. function MPRemoteCallCFM( remoteProc: MPRemoteProcedure; parameter: UnivPtr; context: MPRemoteContext ): UnivPtr; external name '_MPRemoteCallCFM';
  1527. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_4, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1528. {
  1529. ¤
  1530. ===========================================================================================
  1531. Checking API Availability
  1532. =========================
  1533. }
  1534. {
  1535. ===========================================================================================
  1536. *** WARNING: You must properly check the availability of MP services before calling them!
  1537. ===========================================================================================
  1538. Checking for the availability of the MP API is rather ugly. This is a historical problem,
  1539. caused by the original implementation letting itself get prepared when it really wasn't
  1540. usable and complicated by some important clients then depending on weak linking to "work".
  1541. (And further complicated by CFM not supporting "deferred" imports, which is how many
  1542. programmers think weak imports work.)
  1543. The end result is that the MP API library may get prepared by CFM but be totally unusable.
  1544. This means that if you import from the MP API library, you cannot simply check for a
  1545. resolved import to decide if MP services are available. Worse, if you explicitly prepare
  1546. the MP API library you cannot assume that a noErr result from GetSharedLibrary means that
  1547. MP services are available.
  1548. ¥ If you import from the MP API library you MUST:
  1549. Use the MPLibraryIsLoaded macro (or equivalent code in languages other than C) to tell
  1550. if the MP API services are available. It is not sufficient to simply check that an
  1551. imported symbol is resolved as is commonly done for other libraries. The macro expands
  1552. to the expression:
  1553. ( ( (UInt32)_MPIsFullyInitialized != (UInt32)kUnresolvedCFragSymbolAddress ) &&
  1554. ( _MPIsFullyInitialized () ) )
  1555. This checks if the imported symbol _MPIsFullyInitialized is resolved and if resolved
  1556. calls it. Both parts must succeed for the MP API services to be available.
  1557. ¥ If you explicitly prepare the MP API library you MUST:
  1558. Use code similar to the following example to tell if the MP API services are available.
  1559. It is not sufficient to depend on just a noErr result from GetSharedLibrary.
  1560. OSErr err;
  1561. Boolean mpIsAvailable = false;
  1562. CFragConnectionID connID = kInvalidID;
  1563. MPIsFullyInitializedProc mpIsFullyInitialized = NULL;
  1564. err = GetSharedLibrary ( "\pMPLibrary", kCompiledCFragArch, kReferenceCFrag,
  1565. &connID, NULL, NULL );
  1566. if ( err == noErr ) (
  1567. err = FindSymbol ( connID, "\p_MPIsFullyInitialized",
  1568. (Ptr *) &mpIsFullyInitialized, NULL );
  1569. )
  1570. if ( err == noErr ) (
  1571. mpIsAvailable = (* mpIsFullyInitialized) ();
  1572. )
  1573. ===========================================================================================
  1574. }
  1575. {
  1576. * _MPIsFullyInitialized() *** DEPRECATED ***
  1577. *
  1578. * Mac OS X threading:
  1579. * Thread safe
  1580. *
  1581. * Availability:
  1582. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1583. * CarbonLib: in CarbonLib 1.0 and later
  1584. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1585. }
  1586. function _MPIsFullyInitialized: Boolean; external name '__MPIsFullyInitialized';
  1587. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1588. type
  1589. MPIsFullyInitializedProc = function: Boolean;
  1590. const
  1591. kMPUnresolvedCFragSymbolAddress = 0;
  1592. MPLibraryIsLoaded = true;
  1593. {
  1594. ¤
  1595. ===========================================================================================
  1596. Miscellaneous Services
  1597. ======================
  1598. }
  1599. {
  1600. * _MPLibraryVersion() *** DEPRECATED ***
  1601. *
  1602. * Availability:
  1603. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1604. * CarbonLib: in CarbonLib 1.0 and later
  1605. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1606. }
  1607. procedure _MPLibraryVersion( versionCString: ConstCStringPtrPtr; major: UInt32Ptr; minor: UInt32Ptr; release: UInt32Ptr; revision: UInt32Ptr ); external name '__MPLibraryVersion';
  1608. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1609. {
  1610. ¤
  1611. ===========================================================================================
  1612. Unofficial Services
  1613. ===================
  1614. }
  1615. {
  1616. ===========================================================================================
  1617. *** WARNING ***
  1618. These services are not part of the officially documented multiprocessing API. They may not
  1619. be avaliable in future versions of Mac OS multiprocessing support, or in environments that
  1620. have a different underlying OS architecture such as Mac OS on top of a microkernel, the
  1621. Mac OS Blue Box under Mac OS X, native MP support in Mac OS X, etc.
  1622. ===========================================================================================
  1623. }
  1624. {$ifc CALL_NOT_IN_CARBON}
  1625. {
  1626. * _MPAllocateSys()
  1627. *
  1628. * Availability:
  1629. * Mac OS X: not available
  1630. * CarbonLib: not available
  1631. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1632. }
  1633. { Use MPAllocateAligned instead.}
  1634. {
  1635. * _MPRPC()
  1636. *
  1637. * Availability:
  1638. * Mac OS X: not available
  1639. * CarbonLib: not available
  1640. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1641. }
  1642. { Use _MPRemoteCall instead.}
  1643. {
  1644. * _MPTaskIsToolboxSafe()
  1645. *
  1646. * Availability:
  1647. * Mac OS X: not available
  1648. * CarbonLib: not available
  1649. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1650. }
  1651. {$endc} {CALL_NOT_IN_CARBON}
  1652. {
  1653. * _MPLibraryIsCompatible() *** DEPRECATED ***
  1654. *
  1655. * Availability:
  1656. * Mac OS X: in version 10.0 and later in CoreServices.framework but deprecated in 10.7
  1657. * CarbonLib: in CarbonLib 1.0 and later
  1658. * Non-Carbon CFM: in MPLibrary 1.0 and later
  1659. }
  1660. function _MPLibraryIsCompatible( versionCString: ConstCStringPtr; major: UInt32; minor: UInt32; release: UInt32; revision: UInt32 ): Boolean; external name '__MPLibraryIsCompatible';
  1661. (* __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_7, __IPHONE_NA, __IPHONE_NA) *)
  1662. {
  1663. ¤
  1664. ===========================================================================================
  1665. Defunct Services
  1666. ================
  1667. }
  1668. {$ifc CALL_NOT_IN_CARBON}
  1669. {$ifc undefined MPIncludeDefunctServices}
  1670. {$setc MPIncludeDefunctServices := 0}
  1671. {$endc}
  1672. {$ifc MPIncludeDefunctServices}
  1673. {
  1674. * _MPDebugStr()
  1675. *
  1676. * Availability:
  1677. * Mac OS X: not available
  1678. * CarbonLib: not available
  1679. * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
  1680. }
  1681. {
  1682. * _MPStatusPString()
  1683. *
  1684. * Availability:
  1685. * Mac OS X: not available
  1686. * CarbonLib: not available
  1687. * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
  1688. }
  1689. {
  1690. * _MPStatusCString()
  1691. *
  1692. * Availability:
  1693. * Mac OS X: not available
  1694. * CarbonLib: not available
  1695. * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
  1696. }
  1697. type
  1698. MPPrintfHandler = procedure( taskID: MPTaskID; format: ConstCStringPtr; args: va_list );
  1699. {
  1700. * _MPInitializePrintf()
  1701. *
  1702. * Availability:
  1703. * Mac OS X: not available
  1704. * CarbonLib: not available
  1705. * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
  1706. }
  1707. {
  1708. * _MPPrintf()
  1709. *
  1710. * Availability:
  1711. * Mac OS X: not available
  1712. * CarbonLib: not available
  1713. * Non-Carbon CFM: in MPLibraryObsolete 1.0 and later
  1714. }
  1715. {$endc} {MPIncludeDefunctServices}
  1716. {$endc} {CALL_NOT_IN_CARBON}
  1717. { ===========================================================================================}
  1718. {$endc} {TARGET_OS_MAC}
  1719. {$ifc not defined MACOSALLINCLUDE or not MACOSALLINCLUDE}
  1720. end.
  1721. {$endc} {not MACOSALLINCLUDE}