As per the WG call today, it is high implementation overhead to require that team handles be checked for validity in the various teams calls. If handles are pointers, and the team has been destroyed, the implementation would generally just dereference the invalid pointer. There would be no way to check for valid pointers except to keep some structure of valid team handles and lookup each handle.
One way to deal with this would be to change team_destroy to take a pointer to team handle and set the handle to SHMEM_TEAM_NULL on successful destroy. Then have the various team functions which take a handle parameter to define behavior when SHMEM_TEAM_NULL is passed as argument, i.e. shmem_team_my_pe returns -1 when passed SHMEM_TEAM_NULL. Behavior for invalid team handles would be undefined.
As per the WG call today, it is high implementation overhead to require that team handles be checked for validity in the various teams calls. If handles are pointers, and the team has been destroyed, the implementation would generally just dereference the invalid pointer. There would be no way to check for valid pointers except to keep some structure of valid team handles and lookup each handle.
One way to deal with this would be to change team_destroy to take a pointer to team handle and set the handle to SHMEM_TEAM_NULL on successful destroy. Then have the various team functions which take a handle parameter to define behavior when SHMEM_TEAM_NULL is passed as argument, i.e. shmem_team_my_pe returns -1 when passed SHMEM_TEAM_NULL. Behavior for invalid team handles would be undefined.