This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/AbstractServerAction.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
class:: AbstractServerAction
summary:: register actions to be taken for a server
related:: Classes/Server, Classes/ServerBoot, Classes/ServerTree, Classes/ServerQuit
categories:: Control

description::

This is an strong::abstract superclass:: for singletons like link::Classes/ServerQuit::, which provides a place for registering functions and objects for events that should happen when something happens in the server.
No direct call to AbstractServerAction is required.

note:: not fully working on linux and windows.
Setting the computer to sleep on these systems causes the actions to be called.
As to date in linux, JACK does not survive a sleep, it nevertheless behaves correctly for the time being.
::

ClassMethods::

method::functionSelector
Subclasses return specific function selectors for objects that implement this as interface.
Selectors are:
list::
## doOnServerBoot - link::Classes/ServerBoot::
## doOnServerQuit - link::Classes/ServerQuit::
## doOnServerTree - link::Classes/ServerTree::
::

not for registry with a server, but analogous are:
list::
## doOnCmdPeriod - link::Classes/CmdPeriod::
## doOnStartUp - link::Classes/StartUp::
## doOnShutDown - link::Classes/ShutDown::
::

method::add
Add an action or object for registry.

argument::object
Can either be a link::Classes/Function:: to be evaluated (as first arg the server is passed in), or an link::Classes/Object:: that implements the message returned by link::#-functionSelector::. strong::One object is only registered once::, so that multiple additions don't cause multiple calls.

argument::server
Server for which to register. If the symbol strong::\default:: is passed in, the action is called for the current default server. If the symbol strong::\all:: is passed in, the action is called for all current servers. If server is nil, it is added to \default.

method::remove
Remove an item or object from registry. If server is nil, remove from strong::default:: key.

method::removeServer
Remove all items that are registered for a given server.

Examples::

code::
// ServerBoot
s.boot;
f = { |server| "------------The server '%' has booted.------------\n".postf(server) };
ServerBoot.add(f, \default);
s.quit; // quit the server and observe the post
s.boot;
ServerBoot.remove(f, \default); // remove it again
s.quit;
s.boot;// no post.
ServerBoot.add(f, Server.internal);
Server.internal.quit;
Server.internal.boot;
ServerBoot.removeAll; // clear all
::

code::
// ServerQuit
s.boot;
f = { |server| "------------The server '%' has quit.------------\n".postf(server) };
ServerQuit.add(f, \default);
s.quit; // quit the server and observe the post
s.boot;
ServerQuit.remove(f, \default); // remove it again
s.quit; // no post.
ServerQuit.add(f, Server.internal);
Server.internal.boot;
Server.internal.quit;
ServerQuit.removeAll; // clear all
::

code::
// ServerTree
s.quit;
f = { |server| "-------The server '%' has initialised tree.-------\n".postf(server) };
g = { |server| 10.do { Group(server).postln } };
ServerBoot.add(f, \default);
ServerTree.add(g, \default);
s.boot; // boot and see how the actions are evaluated in order
// "cmd-period" (or equivalent) resends the groups.

ServerBoot.removeAll; // clear all
ServerTree.removeAll; // clear all
::