Skip to content

Commit a7d34c6

Browse files
committed
remove some code
1 parent 6567b07 commit a7d34c6

File tree

1 file changed

+2
-38
lines changed

1 file changed

+2
-38
lines changed

runtime/process-posix.c

+2-38
Original file line numberDiff line numberDiff line change
@@ -54,32 +54,6 @@ static ChildProcess* get_child_process (pid_t pid){
5454
else return curr->proc;
5555
}
5656

57-
// Remove the ChildProcess with the given process id from the
58-
// 'child_processes' list if it exists in the list.
59-
// Precondition: SIGCHLD is blocked
60-
static void remove_child_process (pid_t pid) {
61-
62-
// Find the ChildProcess with matching pid.
63-
// After this loop, either:
64-
// 1. curr is NULL: No matching ChildProcess was found.
65-
// 2. curr is ChildProcessList*: The matching ChildProcess was found.
66-
volatile ChildProcessList * volatile curr = child_processes;
67-
volatile ChildProcessList * volatile prev = NULL;
68-
while(curr != NULL && curr->proc->pid != pid) {
69-
prev = curr;
70-
curr = curr->next;
71-
}
72-
73-
// Remove child process from list if one was found.
74-
if(curr != NULL){
75-
if(prev == NULL)
76-
child_processes = curr->next;
77-
else
78-
prev->next = curr->next;
79-
//free((void*) curr);
80-
}
81-
}
82-
8357
// After a child process is spawned, this function creates a
8458
// ChildProcess struct for recording the child's metadata
8559
// and stores it in the 'child_processes' list.
@@ -140,27 +114,17 @@ static void update_child_status (pid_t pid) {
140114
int ret_pid = waitpid(pid, &status, WNOHANG | WUNTRACED | WCONTINUED);
141115

142116
//waitpid returns a positive integer if the process status has changed.
143-
if(ret_pid > 0) {
117+
if(ret_pid > 0)
144118
set_child_status(pid, status);
145-
// Remove the child's metadata from list if child is dead.
146-
//if(is_dead_status(status))
147-
// remove_child_process(pid);
148-
}
149119
}
150120

151121
// Update the current status of all registered child processes.
152122
// Precondition: SIGCHLD is blocked
153123
static void update_all_child_statuses () {
154124
volatile ChildProcessList * volatile curr = child_processes;
155125
while(curr != NULL) {
156-
//NOTE: curr->next is retrieved preemptively because
157-
//update_child_status may call free() on curr, and make
158-
//curr->next inaccessible.
159-
//TODO: this is no longer true once update_child_status
160-
// does not call free
161-
volatile ChildProcessList* next = curr->next;
162126
update_child_status(curr->proc->pid);
163-
curr = next;
127+
curr = curr->next;
164128
}
165129
}
166130

0 commit comments

Comments
 (0)