- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I read about reentrant function versions and I was goint to use them (in fact I have them already converted in my code). During the debugging I entered accidently into the _read_r function and I have seen its body:
ssize_t _DEFUN (_read_r, (ptr, fd, buf, cnt), struct _reent *ptr _AND int fd _AND _PTR buf _AND size_t cnt) { _ssize_t ret; errno = 0; if ((ret = (_ssize_t)_read (fd, buf, cnt)) == -1 && errno != 0) ptr->_errno = errno; return ret; } Looking at this source code I find this function NOT REENTRANT! Nothing stops an interrupt to arrive between seting global errno and copying its value to a struct _reent. Such intterupt would cause reschedule in MicroC/OS and the other task can use global errno variable for its own and modify its value before the scheduler returns control to the previous task. I see no point of using these functions - am I correct thinking they do not do any good ?Link Copied
0 Replies

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page