For Better Performance Please Use Chrome or Firefox Web Browser

pThread proctype

Line# Code
1 proctype pThread()
2 {     chan ret_chan = [0] of {int};
       mtype: process_event_t ev; mtype: process_data_t data;
4        PT_Assignment: pThread_params_chan ? -1,ev,data; // wait for running thread and assigning it to a process
5                                   if
6                                   ::ev==ASIGN_PTHREAD -> pThread_sync_chan ! _pid,0;
7                                   :: else -> goto PT_Assignment; fi;
8        PT_BEGIN: pThread_params_chan ? eval(_pid),ev,data;// wait for start process
9                            if
10                            :: ev==PROCESS_EVENT_INIT-> skip;
11                            :: else -> goto PT_BEGIN;
12                            fi;
13        PT_Statements: if
14                                   :: postRandomEvent();
15                                   :: startRandomProcess();
16                                   :: skip;
17                                   fi;
18        if
19        :: goto PT_WAIT; // wait for another event
20        :: goto PT_END; // termintation
21        :: goto PT_Statements;
22        fi;
23        PT_WAIT: // wait for an event
24               pThread_sync_chan ! _pid,PT_WAITING;
25               pThread_params_chan ? eval(_pid),ev,data // blocked
26        if
27        :: ev == PT_INIT -> goto PT_BEGIN;
28        :: else -> goto PT_Statements;
29        fi;
30        PT_END: if
31                        ::pThread_sync_chan ! _pid,PT_ENDED; // termintation
32                        ::pThread_sync_chan ! _pid,PT_EXITED;// termintation
33                        fi;
34        goto PT_BEGIN; // for starting process again maybe in the future
35 }

ارتقاء امنیت وب با وف ایرانی

pThread proctype | Dr.Elham Mahmoudzadeh

Error

The website encountered an unexpected error. Please try again later.

ارتقاء امنیت وب با وف ایرانی