../../AspectXLib/RealTime/Entry/aspects/Entry.axtrigger as a barrier.
The barrier is accessed in mutual exclusion. It uses mutex object to
protect the method (entry) against multiple access to the method and
condition variable condvar to control the access to the barrier.
The activation code uses synchronization primitives provided by the POSIX standard.
Pointcuts | |
| class | targetClassDeclaration |
|
Points to the target class declaration | |
| unit | targetClassDefinition |
|
Points to the target unit where method of the given class are defined | |
| unit | targetClassUnit |
|
Points to the target unit where class identified
by pointcut targetClassDeclaration is declared | |
| function | targetSynchronizedFunction |
|
Point to the function definition that has to be synchronized | |
| unit | targetInitializationUnit |
|
Points to the unit that contains main() method | |
Advices | |
| add | addSynchronizationDefinition |
|
Adds declaration and initialization of three variables
needed to implement the mutual exclusive access
to the condition variable trigger | |
| add | addSynchronizationDeclaration |
|
Adds external declaration of three variables
needed to implement the mutual exclusive access
to the condition variable trigger | |
| add | addInclude |
|
Add the #include <pthread | |
| begin | atBegin |
|
Inserts the code that locks the access to the method body
by acquiring the mutex | |
| end | atEnd |
|
Inserts the code that release the access to the method body
by releasing the mutex | |
| replace | guardConditionChange |
|
Inserts the code to the main() function
that changes the barrier by setting the
trigger variable to non-zero value | |
UniqueResource.
targetClassDeclaration.
targetClassDeclaration is declared.
UniqueResource::activate()
main() method.
The pointcut is restricted to include only those units that contain
function whose full name is 'main'.
Triplet: unit add declaration
trigger.
This advice has to precede other advices that modify code
in the main unit.
Refers to global pointcut: unit targetClassDefinition
Triplet: unit add declaration
trigger.
Refers to global pointcut: unit targetInitializationUnit
Triplet: unit add include
#include <pthread.h> preprocessor instruction.
Header file pthread.h contain declaration
of methods and data types implementing mutual
exclusive access policy according to the POSIX standard.
Refers to global pointcut: unit targetClassDefinition
Triplet: function begin codeFragment
mutex. The code is inserted at the very
beginning of the target method.
Refers to global pointcut: function targetSynchronizedFunction
Triplet: function end codeFragment
mutex. The code is inserted at the very
end of the target method.
Refers to global pointcut: function targetSynchronizedFunction
Triplet: comment replace codeFragment
main() function
that changes the barrier by setting the
trigger variable to non-zero value.
This has to be done in mutual exclusion. Note
that in this example the barrier is the condition
(!trigger).
Local Pointcut: comment (source)