Home/Support/Support Forum/Re-entrant or non-reentrant functions
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

Re-entrant or non-reentrant functions

0 votes
Where can I get a list of the grouping 'DC library', What the functions is classified as re-entrant or non-reentrant? Thanks
asked Jun 2, 2015 in Rabbit by edha Community Contributor (71 points)

Please log in or register to answer this question.

1 Answer

+1 vote
 
Best answer
The Dynamic C Function Reference manual at:

http://ftp1.digi.com/support/documentation/90001215_C.pdf

has a list of all the functions. If you search for re-entrant you will see which functions require special care in multitasking setups.

Regards,
Peter
answered Jun 2, 2015 by petermcs Veteran of the Digi Community (1,130 points)
selected Jun 2, 2015 by edha
I see from that document(Dynamic C Function Reference Manual), almost all the functions of DC are non-reentrant(can't be used by more than one task without lost data, cant' be interrupted at any time and continue later without loss of data).

How do DC functions can be used for preemptive multitasking? Thanks.
I would have said that the majority of the functions in the DC libraries are re-entrant and I have had no issues so far. Even some of the ones that are non re-entrant on the comms side are ok to use if they are being used for separate com ports per task or if one task is reading and another writing.

If there are issues you may need to use a mutex to protect the shared functions - the TCP/IP libraries for example do this when uCOS/II is being used and I have used these libraries from several tasks in my products without issue (I usually have a single task calling the tcp_tick() function to simplify things so that I don't   have to pepper my code with calls to it.

You will run into  the same issue with your own libraries and may need to take appropriate measures (I use parts of the BACnet library from multiple tasks and have a mutex to manage the sharing.

Regards,
Peter
...