On 19.09.2013 10:57, Vikram Bhagat
wrote:
Hello,
I am not clear under standing the difference between
epicsThreads and pthread. In developing asyn based device
support, What i should be used?
For example i make some calculation in separate thread,
which was talking long time and i want to do other work in
parallel. Should i use pthread or epicsThread?
Hi Vikram,
The epicsThread API is part of the OSI layer, which adds a common
EPICS API to operating system services. (E.g., threads, timers,
semaphores, ...)
This ensures portability of code across all systems and
architectures supported by EPICS.
For things in the OSI layer, there is usually a POSIX
implementation, which is used on POSIX compliant platforms. In many
cases vxWorks, RTEMS, or Windows use a different implementation for
the same feature.
So:
If you use epicsThread, your code will run on all EPICS systems.
If you use pthread, your code will only run on POSIX compliant
systems.
Please use the OSI APIs whenever possible, to allow as many people
as possible to use your code.
HTH,
~Ralph