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

Function lwp_session_delete

components/lwp/lwp_session.c:86–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86int lwp_session_delete(rt_session_t session)
87{
88 int retry = 1;
89 lwp_tty_t ctty;
90
91 /* parameter check */
92 if (session == RT_NULL)
93 {
94 return -EINVAL;
95 }
96
97 /* clear children sid */
98 lwp_session_update_children_info(session, 0);
99
100 while (retry)
101 {
102 retry = 0;
103 ctty = session->ctty;
104 SESS_LOCK_NESTED(session);
105
106 if (session->ctty == ctty)
107 {
108 if (ctty)
109 {
110 SESS_UNLOCK(session);
111
112 /**
113 * Note: it's safe to release the session lock now. Even if someone
114 * race to acquire the tty, it's safe under protection of tty_lock()
115 * and the check inside
116 */
117 tty_lock(ctty);
118 tty_rel_sess(ctty, session);
119 session->ctty = RT_NULL;
120 }
121 else
122 {
123 SESS_UNLOCK(session);
124 }
125 }
126 else
127 {
128 SESS_UNLOCK(session);
129 retry = 1;
130 }
131 }
132
133 rt_object_detach(&(session->object));
134 rt_mutex_detach(&(session->mutex));
135 rt_free(session);
136
137 return 0;
138}
139
140int lwp_session_insert(rt_session_t session, rt_processgroup_t group)
141{

Callers 1

lwp_session_removeFunction · 0.85

Calls 5

tty_rel_sessFunction · 0.85
rt_object_detachFunction · 0.85
rt_mutex_detachFunction · 0.85
rt_freeFunction · 0.85

Tested by

no test coverage detected