RTEMS | posix/aio: Implemented aio_suspend() (!275)
Alessandro Nardin (@AlessandroNardin)
gitlab at rtems.org
Wed Dec 18 14:49:41 UTC 2024
Alessandro Nardin commented on a discussion on cpukit/posix/src/aio_suspend.c: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/275#note_116975
> + /* Initialize suspendcb */
> + suspendcbp = malloc( sizeof( rtems_aio_suspendcb ) );
> + if ( suspendcbp == NULL ) {
> + rtems_set_errno_and_return_minus_one( ENOMEM );
> + }
> +
> + result = pthread_mutex_init( &suspendcbp->mutex, NULL );
> + if ( result != 0 ) {
> + free( suspendcbp );
> + if ( errno == ENOMEM ) {
> + rtems_set_errno_and_return_minus_one( ENOMEM );
> + }
> + rtems_set_errno_and_return_minus_one( EAGAIN );
> + }
> +
> + pthread_mutex_lock( &suspendcbp->mutex );
I need to lock the suspendcb before making the various requests pointing to it in the for loop. This avoids having the rtems_aio_update_suspendcbp called before all the requests are modified, since it could cause some errors.
I could move the lock down near line 97, but I have a concern that Doxygen might detect it as a problem since I would then be modifying the suspendcb without holding the lock.
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/275#note_116975
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20241218/2fefbcb1/attachment-0001.htm>
More information about the bugs
mailing list