blob: 9a7fe8d2e594897479a86e06bf824aee23d7d8d3 [file] [log] [blame]
MG Mud User88f12472016-06-24 23:31:02 +02001SYNOPSIS
2 void slow_shut_down(int minutes)
3
4DESCRIPTION
5 Schedule a shutdown for the near future. minutes is the
6 desired time in minutes till the shutdown:
7 six, if just the user reserve has been put into use.
8 one, if the (smaller) master reserve has been put into use as
9 well.
10
11 The interpreter calls this function when it runs low on
12 memory. At this time, it has freed its reserve, but since it
13 won't last long, the interpreter needs to be shut down. The
14 delay is to give the users the opportunity to finish their
15 current tasks, but don't take the 'minutes' for granted, just
16 deduce the urgency from it.
17 It is possible that the driver may reallocate some memory
18 after the function has been called, and then run again into a
19 low memory situation, calling this function again.
20 This function might load an 'Armageddon' object and tell it
21 what to do. It is the Armageddon object then which performs
22 the shutdown.
23
24 Technical: The memory handling of the interpreter includes
25 three reserved areas: user, system and master. All three are
26 there to insure that the system shuts down gracefully when the
27 memory runs out: the user area to give the users time to
28 quit normally, the others to enable emergency-logouts when the
29 user reserve is used up as well.
30 The areas are allocated at start of the interpreter, and
31 released when no more memory could be obtained from the host.
32 In such a case, one of the remaining areas is freed (so the
33 operation can continue a short while) and a garbage collection
34 is initiated. If the garbage collection recycles enough memory
35 (either true garbage or by the aid of the quota_demon) to
36 reallocate the areas, all is fine, else the system shut down
37 is invoked by a call to this function.
38
39SEE ALSO
40 quota_demon(M), notify_shutdown(M), shutdown(E), malloc(D), memory(C)