|
| | __init__ (self, type_code, thread_protect=True, name=None) |
| | Create a shared data item used to transfer data between tasks.
|
| | put (self, data, in_ISR=False) |
| | Write an item of data into the share.
|
| | get (self, in_ISR=False) |
| | Read an item of data from the share.
|
| | __repr__ (self) |
| | Puts diagnostic information about the share into a string.
|
| | __init__ (self, type_code, thread_protect=True, name=None) |
| | Create a base queue object when called by a child class initializer.
|
An item which holds data to be shared between tasks.
This class implements a shared data item which can be protected against data corruption by pre-emptive multithreading. Multithreading which can corrupt shared data includes the use of ordinary interrupts as well as the use of pre-emptive multithreading such as by a Real-Time Operating System (RTOS).
An example of the creation and use of a share is as follows:
import task_share
my_share.put (some_data)
something = my_share.get ()
A queue which is used to transfer data from one task to another.
Definition task_share.py:90
| task_share.Share.__init__ |
( |
| self, |
|
|
| type_code, |
|
|
| thread_protect = True, |
|
|
| name = None ) |
Create a shared data item used to transfer data between tasks.
This method allocates memory in which the shared data will be buffered.
Each share can only carry data of one particular type which must be chosen from the following list. The data type is specified by a one-letter type code which is given as for the Python array.array type, which can be any of the following:
| | |
| b (signed char) | B (unsigned char) | 8 bit integers |
| h (signed short) | H (unsigned short) | 16 bit integers |
| i (signed int) | I (unsigned int) | 32 bit integers (probably) |
| l (signed long) | L (unsigned long) | 32 bit integers |
| q (signed long long) | Q (unsigned long long) | 64 bit integers |
| f (float) | d (double-precision float) | |
- Parameters
-
| type_code | The type of data items which the share can hold |
| thread_protect | True if mutual exclusion protection is used |
| name | A short name for the share, default ShareN where N is a serial number for the share |