Mercurial > projects > dstep
view dstep/coreservices/carboncore/Multiprocessing.d @ 11:07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 01 Aug 2009 15:03:28 +0200 |
parents | |
children |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Jul 21, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.coreservices.carboncore.Multiprocessing; //import dstep.AvailabilityMacros; import dstep.coreservices.carboncore.MacTypes; //import dstep.stdarg; struct OpaqueMPProcessID; struct OpaqueMPTaskID; struct OpaqueMPQueueID; struct OpaqueMPSemaphoreID; struct OpaqueMPCriticalRegionID; struct OpaqueMPTimerID; struct OpaqueMPEventID; struct OpaqueMPAddressSpaceID; struct OpaqueMPNotificationID; struct OpaqueMPCoherenceID; struct OpaqueMPCpuID; struct OpaqueMPAreaID; struct OpaqueMPConsoleID; struct OpaqueMPOpaqueID; alias OpaqueMPProcessID* MPProcessID; alias OpaqueMPTaskID* MPTaskID; alias OpaqueMPQueueID* MPQueueID; alias OpaqueMPSemaphoreID* MPSemaphoreID; alias OpaqueMPCriticalRegionID* MPCriticalRegionID; alias OpaqueMPTimerID* MPTimerID; alias OpaqueMPEventID* MPEventID; alias OpaqueMPAddressSpaceID* MPAddressSpaceID; alias OpaqueMPNotificationID* MPNotificationID; alias OpaqueMPCoherenceID* MPCoherenceID; alias OpaqueMPCpuID* MPCpuID; alias OpaqueMPAreaID* MPAreaID; alias OpaqueMPConsoleID* MPConsoleID; alias OpaqueMPOpaqueID* MPOpaqueID; alias uint MPOpaqueIDClass; alias uint MPTaskOptions; alias uint TaskStorageIndex; alias LogicalAddress TaskStorageValue; alias uint MPSemaphoreCount; alias uint MPTaskWeight; alias uint MPEventFlags; alias uint MPExceptionKind; alias uint MPTaskStateKind; alias uint MPPageSizeClass; alias uint MPDebuggerLevel; alias ubyte MPRemoteContext; extern (C) { alias ubyte function () MPIsFullyInitializedProc; alias void * function (void*) MPRemoteProcedure; alias int function (void*) TaskProc; } enum { MPLibrary_MajorVersion = 2, MPLibrary_MinorVersion = 3, MPLibrary_Release = 1, MPLibrary_DevelopmentRevision = 1 } enum { 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 } enum { kMPNoID = 0 } enum { kDurationImmediate = 0L, kDurationForever = 0x7FFFFFFF, kDurationMillisecond = 1, kDurationMicrosecond = -1 } enum { kMPCreateTaskSuspendedMask = 1L << 0, kMPCreateTaskTakesAllExceptionsMask = 1L << 1, kMPCreateTaskNotDebuggableMask = 1L << 2, kMPCreateTaskValidOptionsMask = kMPCreateTaskSuspendedMask | kMPCreateTaskTakesAllExceptionsMask | kMPCreateTaskNotDebuggableMask } enum { kMPPreserveTimerIDMask = 1L << 0, kMPTimeIsDeltaMask = 1L << 1, kMPTimeIsDurationMask = 1L << 2 } enum { kMPMaxAllocSize = 1024L * 1024 * 1024 } enum { kMPAllocateDefaultAligned = 0, kMPAllocate8ByteAligned = 3, kMPAllocate16ByteAligned = 4, kMPAllocate32ByteAligned = 5, kMPAllocate1024ByteAligned = 10, kMPAllocate4096ByteAligned = 12, kMPAllocateMaxAlignment = 16, kMPAllocateAltiVecAligned = kMPAllocate16ByteAligned, kMPAllocateVMXAligned = kMPAllocateAltiVecAligned, kMPAllocateVMPageAligned = 254, kMPAllocateInterlockAligned = 255 } enum { kMPAllocateClearMask = 0x0001, kMPAllocateGloballyMask = 0x0002, kMPAllocateResidentMask = 0x0004, kMPAllocateNoGrowthMask = 0x0010, kMPAllocateNoCreateMask = 0x0020 } enum { kMPTaskStateRegisters = 0, kMPTaskStateFPU = 1, kMPTaskStateVectors = 2, kMPTaskStateMachine = 3, kMPTaskState32BitMemoryException = 4, kMPTaskStateTaskInfo = 5 } enum { kMPTaskPropagate = 0, kMPTaskResumeStep = 1, kMPTaskResumeBranch = 2, kMPTaskResumeMask = 0x0000, kMPTaskPropagateMask = 1 << kMPTaskPropagate, kMPTaskResumeStepMask = 1 << kMPTaskResumeStep, kMPTaskResumeBranchMask = 1 << kMPTaskResumeBranch } enum { kMPTaskBlocked = 0, kMPTaskReady = 1, kMPTaskRunning = 2 } enum { kMPTaskInfoVersion = 3 } enum { kMPLowLevelDebugger = 0x00000000, kMPMidLevelDebugger = 0x10000000, kMPHighLevelDebugger = 0x20000000 } enum { kMPAnyRemoteContext = 0, kMPOwningProcessRemoteContext = 1, kMPInterruptRemoteContext = 2, kMPAsyncInterruptRemoteContext = 3 } struct MPTaskInfoVersion2 { uint version_; uint name; uint queueName; ushort runState; ushort lastCPU; uint weight; MPProcessID processID; AbsoluteTime cpuTime; AbsoluteTime schedTime; AbsoluteTime creationTime; uint codePageFaults; uint dataPageFaults; uint preemptions; MPCpuID cpuID; } struct MPTaskInfo { uint version_; uint name; uint queueName; ushort runState; ushort lastCPU; uint weight; MPProcessID processID; AbsoluteTime cpuTime; AbsoluteTime schedTime; AbsoluteTime creationTime; uint codePageFaults; uint dataPageFaults; uint preemptions; MPCpuID cpuID; MPOpaqueID blockedObject; MPAddressSpaceID spaceID; LogicalAddress stackBase; LogicalAddress stackLimit; LogicalAddress stackCurr; } extern (C) { uint MPProcessors (); uint MPProcessorsScheduled (); int MPCreateTask (TaskProc entryPoint, void* parameter, uint stackSize, MPQueueID notifyQueue, void* terminationParameter1, void* terminationParameter2, uint options, MPTaskID* task); int MPTerminateTask (MPTaskID task, int terminationStatus); int MPSetTaskWeight (MPTaskID task, uint weight); ubyte MPTaskIsPreemptive (MPTaskID taskID); void MPExit (int status); void MPYield (); MPTaskID MPCurrentTaskID (); int MPSetTaskType (MPTaskID task, uint taskType); int MPAllocateTaskStorageIndex (TaskStorageIndex* taskIndex); int MPDeallocateTaskStorageIndex (uint taskIndex); int MPSetTaskStorageValue (uint taskIndex, TaskStorageValue value); TaskStorageValue MPGetTaskStorageValue (uint taskIndex); int MPCreateQueue (MPQueueID* queue); int MPDeleteQueue (MPQueueID queue); int MPNotifyQueue (MPQueueID queue, void* param1, void* param2, void* param3); int MPWaitOnQueue (MPQueueID queue, void** param1, void** param2, void** param3, int timeout); int MPSetQueueReserve (MPQueueID queue, uint count); int MPCreateSemaphore (uint maximumValue, uint initialValue, MPSemaphoreID* semaphore); int MPDeleteSemaphore (MPSemaphoreID semaphore); int MPSignalSemaphore (MPSemaphoreID semaphore); int MPWaitOnSemaphore (MPSemaphoreID semaphore, int timeout); int MPCreateCriticalRegion (MPCriticalRegionID* criticalRegion); int MPDeleteCriticalRegion (MPCriticalRegionID criticalRegion); int MPEnterCriticalRegion (MPCriticalRegionID criticalRegion, int timeout); int MPExitCriticalRegion (MPCriticalRegionID criticalRegion); int MPCreateEvent (MPEventID* event); int MPDeleteEvent (MPEventID event); int MPSetEvent (MPEventID event, uint flags); int MPWaitForEvent (MPEventID event, MPEventFlags* flags, int timeout); int MPCreateNotification (MPNotificationID* notificationID); int MPDeleteNotification (MPNotificationID notificationID); int MPModifyNotification (MPNotificationID notificationID, MPOpaqueID anID, void* notifyParam1, void* notifyParam2, void* notifyParam3); int MPModifyNotificationParameters (MPNotificationID notificationID, uint kind, void* notifyParam1, void* notifyParam2, void* notifyParam3); int MPCauseNotification (MPNotificationID notificationID); int MPDelayUntil (AbsoluteTime* expirationTime); int MPCreateTimer (MPTimerID* timerID); int MPDeleteTimer (MPTimerID timerID); int MPSetTimerNotify (MPTimerID timerID, MPOpaqueID anID, void* notifyParam1, void* notifyParam2, void* notifyParam3); int MPArmTimer (MPTimerID timerID, AbsoluteTime* expirationTime, uint options); int MPCancelTimer (MPTimerID timerID, AbsoluteTime* timeRemaining); LogicalAddress MPAllocateAligned (uint size, ubyte alignment, uint options); LogicalAddress MPAllocate (uint size); void MPFree (LogicalAddress object); uint MPGetAllocatedBlockSize (LogicalAddress object); void MPBlockCopy (LogicalAddress source, LogicalAddress destination, uint size); void MPBlockClear (LogicalAddress address, uint size); int MPSetExceptionHandler (MPTaskID task, MPQueueID exceptionQ); int MPDisposeTaskException (MPTaskID task, uint action); int MPExtractTaskState (MPTaskID task, uint kind, void* info); int MPSetTaskState (MPTaskID task, uint kind, void* info); int MPThrowException (MPTaskID task, uint kind); int MPRegisterDebugger (MPQueueID queue, uint level); int MPUnregisterDebugger (MPQueueID queue); void* MPRemoteCall (MPRemoteProcedure remoteProc, void* parameter, ubyte context); void* MPRemoteCallCFM (MPRemoteProcedure remoteProc, void* parameter, ubyte context); ubyte _MPIsFullyInitialized (); void _MPLibraryVersion (char** versionCString, UInt32* major, UInt32* minor, UInt32* release, UInt32* revision); ubyte _MPLibraryIsCompatible (char* versionCString, uint major, uint minor, uint release, uint revision); }