📄 banker.h
字号:
#pragma Banker
typedef unsigned int Tag;
typedef void *Manager;
typedef void Guard(Manager m, Tag t, unsigned int r, boolean block);
/* The guard is called by Block with TRUE to block a process and
FALSE to unblock it. Cancel must be used to withdraw a Block. */
void Open(Manager &m, unsigned int Nprs, unsigned int Mres, unsigned int &resLimit[]);
int Request(Manager m, Tag process, unsigned int resource, unsigned int amount);
/* <0 request exceeds available by -value units
0 request exceeds maximum claim
1 unsafe state
2 success
*/
boolean Block(Manager m, Tag process, unsigned int resource, unsigned int amount, Guard p);
/* blocks until request can be safely granted; returns TRUE if blocked */
/* NOTE: block can be called multiple times for a "blocked" process. */
void Cancel(Manager m, Tag process, unsigned int resource, unsigned int amount);
/* used to cancel a currently blocked request; doesn't call the Guard */
unsigned int Available(Manager m, unsigned int resource);
void Release(Manager m, Tag process, unsigned int resource, unsigned int amount);
void Close(Manager &m);
Tag Process(Manager m, unsigned int &maxClaim[]);
void Kill(Manager m, Tag &process);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -