| Line# | Code |
| 1 | //-Begin of process.c\call_process:174-199 |
| 2 | proctype call_process(chan call_process_sync_ch;chan params_chan) |
| 3 | { |
| 4 | chan ret_chan_thread = [0] of {mtype: ptResult}; |
| 5 | chan ret_chan_exit = [0] of {int}; |
| 6 | //- Begin of the parameters list |
| 7 | int p; |
| 8 | mtype:process_event_t ev; |
| 9 | mtype:process_data_t data; |
| 10 | params_chan ? p,ev,data; |
| 11 | //- End of the parameters list |
| 12 | int tmp; |
| 13 | mtype:ptResult ptRes; |
| 14 | if //-- Begin of process.c\call_process:185-198 |
| 15 | :: (processes[p].state == PROCESS_STATE_RUNNING && processes[p].thread!=NULL) -> |
| 16 | process_current = p; |
| 17 | processes[p].state =PROCESS_STATE_CALLED; |
| 18 | //- Begin of process.c\call_process:190 |
| 19 | pThread_params_chan ! processes[p].thread,ev , data ; |
| 20 | pThread_sync_chan ? eval(processes[p].thread),ptRes; |
| 21 | //- End of process.c\call_process:190 |
| 22 | if //-Begin of process.c\call_process:191-197 |
| 23 | :: (ptRes == PT_EXITED || ptRes == PT_ENDED || ev == PROCESS_EVENT_EXIT) -> |
| 24 | //- Begin of process.c\call_process:194 |
| 25 | exit_process_params_chan ! p,p; |
| 26 | run exit_process(ret_chan_exit, exit_process_params_chan); |
| 27 | ret_chan_exit ? tmp; |
| 28 | //- End of process.c\call_process:194 |
| 29 | goto end; |
| 30 | :: else -> processes[p].state = PROCESS_STATE_RUNNING; |
| 31 | goto end; |
| 32 | fi;//-End of process.c\call_process:191-197 |
| 33 | ::else -> goto end; |
| 34 | fi; //-- End of process.c\call_process:185-198 |
| 35 | end: call_process_sync_ch ! 0; |
| 36 | }//-End of process.c\call_process:174-199 |
call_process() proctype
×
https://people.iut.ac.ir/en/mahmoudzadeh/callprocess-proctype?view=qrcode