| 200 | } |
| 201 | |
| 202 | int lwp_pgrp_remove(rt_processgroup_t group, rt_lwp_t process) |
| 203 | { |
| 204 | rt_bool_t is_empty = RT_FALSE; |
| 205 | |
| 206 | /* parameter check */ |
| 207 | if (group == RT_NULL || process == RT_NULL) |
| 208 | { |
| 209 | return -EINVAL; |
| 210 | } |
| 211 | |
| 212 | PGRP_LOCK_NESTED(group); |
| 213 | LWP_LOCK_NESTED(process); |
| 214 | RT_ASSERT(rt_mutex_get_hold(&process->lwp_lock) <= rt_mutex_get_hold(&group->mutex)); |
| 215 | |
| 216 | rt_list_remove(&(process->pgrp_node)); |
| 217 | /* clear children sid and pgid */ |
| 218 | process->pgrp = RT_NULL; |
| 219 | process->pgid = 0; |
| 220 | process->sid = 0; |
| 221 | |
| 222 | LWP_UNLOCK(process); |
| 223 | |
| 224 | is_empty = rt_list_isempty(&(group->process)); |
| 225 | |
| 226 | PGRP_UNLOCK(group); |
| 227 | |
| 228 | if (is_empty) |
| 229 | { |
| 230 | lwp_pgrp_delete(group); |
| 231 | return 1; |
| 232 | } |
| 233 | |
| 234 | return 0; |
| 235 | } |
| 236 | |
| 237 | int lwp_pgrp_move(rt_processgroup_t group, rt_lwp_t process) |
| 238 | { |
no test coverage detected