MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / lwp_pgrp_remove

Function lwp_pgrp_remove

components/lwp/lwp_pgrp.c:202–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

200}
201
202int 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
237int lwp_pgrp_move(rt_processgroup_t group, rt_lwp_t process)
238{

Callers 2

lwp_freeFunction · 0.85
lwp_pgrp_moveFunction · 0.85

Calls 3

rt_list_removeFunction · 0.85
rt_list_isemptyFunction · 0.85
lwp_pgrp_deleteFunction · 0.85

Tested by

no test coverage detected