Understanding The Threading Model
Aaron R.
Tucson, AZ

Jan 6, 2011
9 Posts

Understanding the threading model

The ATEasy data sheet mentions that ATEasy has robust threading support and an advanced threading model.  Where can I find a detailed description of this, including examples?  Is there support for setting the type of threading scheduler (round robin, FIFO, etc) or thread priority?  What about CPU affinity?

Solution Available
DrATEasy (Ron Y.)
Mission Viejo,

Jan 7, 2011
235 Posts

Re: Understanding the threading model

ATEasy uses the Windows threading model, more information see: http://msdn.microsoft.com/en-us/library/ms685100(v=vs.85).aspx.
The on-line help contains a section that explains multi threading (see "MultiThreading" in the Index tab). It explain about multi threading function such as CreateThread, SetThreadPriority, WaitForMultipleObjects etc. It also explain how to use the built in synchronization objects such as AMutex, AEVent, ASemapore etc. The Language.prg and ComChatMT.prj are examples for using some of these objects.

If you like to set the threading/process affinity:
Use one of the following:

BOOL WINAPI SetProcessAffinityMask(
__in HANDLE hProcess,
__in DWORD_PTR dwProcessAffinityMask
);

DWORD_PTR WINAPI SetThreadAffinityMask(
__in HANDLE hThread,
__in DWORD_PTR dwThreadAffinityMask
);


Both functions are defined in kernel32.dll. First parameter can be defined as Val AHandle and second as Val DWord in ATEasy.

You can pass -1 for hProcess (current process). Pass the return value from ATEasy functions CreateThread and GetCurrentThread to hThread.

More information, see http://msdn.microsoft.com/en-us/library/ms686223(v=VS.85).aspx and http://msdn.microsoft.com/en-us/library/ms686247(VS.85).aspx.

Aaron R.
Tucson, AZ

Jan 7, 2011
9 Posts

Re: Understanding the threading model

I will look into the references you mentioned.  Thanks for the reply, its very helpful.



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]