-
Notifications
You must be signed in to change notification settings - Fork 0
Home
The latest versions of shared memory require Gambas 3.18.
This component is composed of two separate interface types Classic C like module interface implemented as the Static class SharedMem. Currently this version is production quality. The second interface is an object oriented implemented by the Class ShmMem currently this interface is in beta but is the fastest and most reliable version.
Both interfaces provide basically the same interface for using shared memory in your application.
Both interfaces allow the user to directly store and retrieve Gambas object, collections, arrays and Native classes directly through simple notation. Some examples ShmMem.MyVar = 1, ShmMem["MyVar"] = 1, ShmMem!MyVar = 1. See later sections for practical examples. The Static Interface uses the same notation : SharedMem.MyVar = 1 .... etc.
There is no requirement to declare a variable before use.
All variables access is fully re-entrant and protected by semaphores.
All Shared memory variables are dynamic and the type may be changed on the fly with one exception. You may not change the type of a variable for which a task/process has asked to be notified when a change occurs.
This component is available by installing from the following Private PPA or as source code from this repository.
curl -s --compressed "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/KEY.gpg" | sudo apt-key add -
sudo curl -s --compressed -o /etc/apt/sources.list.d/gsh.list "https://raw.githubusercontent.com/justlostintime/ppa/main/ubuntu/gsh.list"
sudo apt update
git clone https://github.com/justlostintime/sharedmem.git
In Short Shared memory is used to transfer data between Tasks/Processes in Gambas without using kernel buffer transfers and copies. Memory is accessed and modified directly by each task. Information is available and shared by all tasks as soon as it is changed. The access to each part of shared memory variables is protected from concurrent changes by semaphore locks. All tasks and objects can request to be notified of changes in real time.