This can normally only be done by the owner of the noticeboard. The only things which can be written are shape information and data. The item's modified count is incremented both before and after each write using the ADD_INTERLOCKED instruction. The noticeboard's modified count is incremented after each write. These modified counts allow other processes to monitor the noticeboard for changes.
When writing data to an item, it is possible to specify the offset at which the data is to start. The actual size of the item's data is the high-water mark of all the data that has been written to the item. For example, if 10 bytes are written at offset 0, the size is 10 bytes, but if then 100 bytes are written at offset 4000, the size is 4100 bytes, even though bytes 11 to 4000 have not been written. It is guaranteed that all such unwritten bytes are zero. It is occasionally necessary to adjust the actual size of an item's data and there is a routine explicitly to do this. For example, the size of the above item could be adjusted back to 10 bytes. Note that if 1 byte were now written at an offset of 10000, the item size would now be 10001 bytes and the 100 bytes at offset 4000 would retain the values that they were given earlier (they would not be reset to zero).
There are two global parameters which can be altered using the NBS_TUNE_NOTICEBOARD routine and which affect the behaviour of these routines:
1. WORLD_WRITE is FALSE by default and this prevents processes other than the noticeboard's owner from writing to it. If set TRUE, this process will be allowed to write to the noticeboard even if it does not own it. If set TRUE then it is possible for a reader to read data that is currently varying, so only do this if you know what you are doing. All processes can always access all noticeboard's directly if they do so via pointer -- such access is not affected by the WORLD_WRITE flag.
2. INCREMENT_MODIFY is TRUE by default and this causes the item's modified count to be incremented before and after the update and the noticeboard's modified count to be incremented after the update. If set FALSE, neither count is altered. Clearly, if this is done, other processes monitoring the modified counts will not realise that noticeboard data is changing.
There is also a lower-level routine that must only be used by people who really know what they are doing. It increments either the noticeboard modified count or a primitive item's modified count. This must be called according to the same conventions as are applied in NBS_ PUT_VALUE. If this is not done, the whole system is subverted.
Finally, there is a routine which specifies a user-supplied routine to be called whenever an item's shape, data, size or modified count is altered. This routine is called in the context of the process which alters the noticeboard -- there are no facilities for notifying directly any other processes (although the user-supplied routine may of course do this itself).
- NBS_PUT_VALUE:
- Put a byte array into a slice of a primitive item associated with a specified identifier
- NBS_PUT_CVALUE:
- Put a character string into a slice of a primitive item associated with a specified identifier
- NBS_PUT_SHAPE:
- Put a new shape to a primitive item associated with a specified identifier
- NBS_PUT_SIZE:
- Put a new size to a primitive item associated with a specified identifier
- NBS_INC_MODIFIED:
- Increment the noticeboard modified count or an item modified count depending on whether this is a structured or primitive item
- NBS_PUT_TRIGGER:
- Specify a routine to be called whenever a primitive item is updated
NBS The Noticeboard System