SAM function SAM-Memory-write-prepare()

From SoOS

Jump to: navigation, search


[edit] Name

SAM_Memory_write_prepare - Prepare a region of memory for writing

[edit] Synopsis

#include <sam.h>
void SAM_Memory_write_prepare(SAM_t sam, void *addr);

[edit] Description

The SAM_Memory_write_prepare() function flashes back all the worker threads that have speculatively read the region of memory in which the address addr is contained, and halts the ones that try to access it. The SAM_Memory_write_prepare() function needs a matching call to the function SAM_Memory_write() pointing to the same memory region as addr and within the same SAM Structure object sam context in order to resume the execution of the halted worker threads. This function shall only be called from the main execution thread.

[edit] Return value


[edit] Errors

None, assumes correct input parameters.

[edit] Examples

Example 3 B - Executing speculatively and flashing back a worker thread (efficient version)
Example 4 - Executing speculatively, flashing back, and speculative writing
Example 5 - Using multiple protected memory regions within the same SAM context

[edit] See also

SAM_Memory_speculative_read(), SAM_Memory_speculative_write_prepare(), SAM_Memory_write(), __SAM_ADDR__(), <sam.h>.