Ignore:
Timestamp:
09/29/98 12:15:08 (25 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
21bfd93
Parents:
d7fcc1d
Message:

Patch from Eric Norum <eric@…>:

Remember the test to see if a socket could be read and written at
the same time by two different tasks? I discovered that if both
tasks attempt to close the socket a panic can occur from inside the
BSD code.

Closing the same socket twice from two different threads is
certainly an error, but a panic is not the greatest error reporting
method :-)

The following small change to the socket close routine should reduce
the chances of the panic.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/libnetworking/rtems/rtems_syscall.c

    rd7fcc1d r766ed7c  
    684684                return -1;
    685685        }
    686         error = soclose (so);
    687686        i = rtems_file_descriptor_base(fd);
    688687        fdsock[i].indexFreeNext = indexFreeHead;;
    689688        indexFreeHead = i;
    690         if (error) {
    691                 errno = error;
    692                 rtems_bsdnet_semaphore_release ();
    693                 return -1;
    694         }
    695         rtems_bsdnet_semaphore_release ();
     689        error = soclose (so);
     690        rtems_bsdnet_semaphore_release ();
     691        if (error) {
     692                errno = error;
     693                return -1;
     694        }
    696695        return 0;
    697696}
Note: See TracChangeset for help on using the changeset viewer.