MESH system calls header. More...
Go to the source code of this file.
Functions | |
| void | mesh_yield () |
| Immediately returns control to the scheduler committing any outstanding lightweight consumes in the process. Useful for forcing the scheduler to run after creating new threads, etc. | |
| void | mesh_thread_create_entry (mesh_thread *cr, gchar *key, void *value) |
| Associates a key-value pair with a thread. Useful for storing thread-local data without having to change its type definition. | |
| gboolean | mesh_thread_has_entry (mesh_thread *cr, gchar *key, void **value) |
| Retrives the current value of the specified thread entry if it exists. | |
| void * | mesh_thread_get_entry (mesh_thread *cr, gchar *key) |
| Retrives the current value of the specified thread entry. | |
| void | mesh_thread_set_entry (mesh_thread *cr, gchar *key, void *value) |
| Changes the current value of the specified thread entry. | |
| void | mesh_resource_create_entry (mesh_resource *cr, gchar *key, void *value) |
| Associates a key-value pair with a resource. Useful for storing resource-local data without having to change its type definition. | |
| void * | mesh_resource_get_entry (mesh_resource *cr, gchar *key) |
| Retrives the current value of the specified resource entry. | |
| void | mesh_resource_set_entry (mesh_resource *cr, gchar *key, void *value) |
| Changes the current value of the specified resource entry. | |
| void | mesh_scheduler_create_entry (mesh_scheduler *cs, gchar *key, void *value) |
| Associates a key-value pair with a scheduler. Useful for storing scheduler-local data without having to change its type definition. | |
| void * | mesh_scheduler_get_entry (mesh_scheduler *cs, gchar *key) |
| Retrives the current value of the specified scheduler entry. | |
| void | mesh_scheduler_set_entry (mesh_scheduler *cs, gchar *key, void *value) |
| Changes the current value of the specified scheduler entry. | |
| void | mesh_thread_inc_counter (double) |
| Increment the thread specific counter. | |
| double | mesh_thread_get_and_clear_counter () |
| Return and clear the thread specific counter. This can be used to implement coarse-grained consumes. | |
| gint | mesh_thread_sem_wait (mesh_thread_sem *sem) |
| Block until the semaphore value is greater than zero, then decrement it. | |
| gint | mesh_thread_sem_trywait (mesh_thread_sem *sem) |
| Attempt to decrement the semaphore. Return -1 if the semaphore value is not greater than zero. Return 0 if the semaphore value is greater than zero and the decrement succeeds. This call does not block. | |
| gint | mesh_thread_sem_post (mesh_thread_sem *sem) |
| Increment the semaphore value. This should always succeed. | |
| gint | mesh_thread_sem_post_delayed (mesh_thread_sem *sem) |
| Increment the semaphore value after the next consume call. This uses an implicit increment-memcpy operation in the kernel perform_delayed_actions() function that is activated when the src and dest of memcpy is equal. Since memcpy() does not support equal src and dest addresses, this was special case was used to minimize changes in the code. | |
| gint | mesh_thread_mutex_init (mesh_thread_mutex *mutex, void *attr) |
| Initializes the mutex pointed to by mutex. | |
| gint | mesh_thread_mutex_lock (mesh_thread_mutex *mutex) |
| Locks the given mutex. If the mutex is currently locked mesh_thread_mutex_lock. | |
| gint | mesh_thread_mutex_unlock (mesh_thread_mutex *mutex) |
| Unlocks the given mutex. Resumes any other logical threads which are blocked on this mutex. | |
| gint | mesh_thread_mutex_unlock_delayed (mesh_thread_mutex *mutex) |
| Unlocks the given mutex at the end of this consume region. Resumes any other logical threads which are blocked on this mutex. | |
| gint | mesh_thread_mutex_destroy (mesh_thread_mutex *mutex) |
| Destroys the mutex specified by mutex. The mutex must be unlocked on entrance. This frees all resources associated with the mutex. | |
| gint | mesh_thread_mutex_trylock (mesh_thread_mutex *mutex) |
| Behaves identically to mesh_thread_mutex_lock except that it does not block if the mutex is already locked. Instead it. | |
MESH system calls header.
| void mesh_resource_create_entry | ( | mesh_resource * | cr, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Associates a key-value pair with a resource. Useful for storing resource-local data without having to change its type definition.
| cr | Resource to create entry for | |
| key | Entry key | |
| value | Entry starting value precond The key must not already be in use |
| void* mesh_resource_get_entry | ( | mesh_resource * | cr, | |
| gchar * | key | |||
| ) |
Retrives the current value of the specified resource entry.
| cr | Resource to get entry for | |
| key | Entry's key precond Entry must have been previously created by calling mesh_resource_create_entry() . |
| void mesh_resource_set_entry | ( | mesh_resource * | cr, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Changes the current value of the specified resource entry.
| cr | Resource to set entry for | |
| key | Entry's key | |
| value | Entry's new value precond Entry must have been previously created by calling mesh_resource_create_entry() . |
| void mesh_scheduler_create_entry | ( | mesh_scheduler * | cs, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Associates a key-value pair with a scheduler. Useful for storing scheduler-local data without having to change its type definition.
| cr | Scheduler to create entry for | |
| key | Entry's key | |
| value | Entry's starting value precond The key must not already be in use |
| void* mesh_scheduler_get_entry | ( | mesh_scheduler * | cs, | |
| gchar * | key | |||
| ) |
Retrives the current value of the specified scheduler entry.
| cr | Scheduler to get entry for | |
| key | Entry's key precond Entry must have been previously created by calling mesh_scheduler_create_entry() . |
| void mesh_scheduler_set_entry | ( | mesh_scheduler * | cs, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Changes the current value of the specified scheduler entry.
| cr | Scheduler to set entry for | |
| key | Entry's key | |
| value | Entry's new value precond Entry must have been previously created by calling mesh_scheduler_create_entry() . |
| void mesh_thread_create_entry | ( | mesh_thread * | cr, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Associates a key-value pair with a thread. Useful for storing thread-local data without having to change its type definition.
| cr | Thread to create entry for | |
| key | Entry's key | |
| value | Entry's starting value precond The key must not already be in use |
| double mesh_thread_get_and_clear_counter | ( | ) |
Return and clear the thread specific counter. This can be used to implement coarse-grained consumes.
| void* mesh_thread_get_entry | ( | mesh_thread * | cr, | |
| gchar * | key | |||
| ) |
Retrives the current value of the specified thread entry.
| cr | Thread to get entry for | |
| key | Entry's key precond Entry must have been previously created by calling mesh_thread_create_entry() . |
| gboolean mesh_thread_has_entry | ( | mesh_thread * | cr, | |
| gchar * | key, | |||
| void ** | value | |||
| ) |
Retrives the current value of the specified thread entry if it exists.
| cr | Thread to check for entry | |
| key | Entry's key | |
| value | Pointer to hold entry (if it exists) |
| void mesh_thread_inc_counter | ( | double | val | ) |
Increment the thread specific counter.
| gint mesh_thread_mutex_destroy | ( | mesh_thread_mutex * | mutex | ) |
Destroys the mutex specified by mutex. The mutex must be unlocked on entrance. This frees all resources associated with the mutex.
| mutex | Mutex to destroy |
| gint mesh_thread_mutex_init | ( | mesh_thread_mutex * | mutex, | |
| void * | attr | |||
| ) |
Initializes the mutex pointed to by mutex.
| mutex | Mutex to create | |
| attr | Attributes, not used |
| gint mesh_thread_mutex_lock | ( | mesh_thread_mutex * | mutex | ) |
Locks the given mutex. If the mutex is currently locked mesh_thread_mutex_lock.
| mutex | Mutex to lock |
| gint mesh_thread_mutex_trylock | ( | mesh_thread_mutex * | mutex | ) |
Behaves identically to mesh_thread_mutex_lock except that it does not block if the mutex is already locked. Instead it.
| mutex | Mutex to attempt to lock |
| gint mesh_thread_mutex_unlock | ( | mesh_thread_mutex * | mutex | ) |
Unlocks the given mutex. Resumes any other logical threads which are blocked on this mutex.
| mutex | Mutex to unlock |
| gint mesh_thread_mutex_unlock_delayed | ( | mesh_thread_mutex * | mutex | ) |
Unlocks the given mutex at the end of this consume region. Resumes any other logical threads which are blocked on this mutex.
| mutex | Mutex to unlock |
| gint mesh_thread_sem_post | ( | mesh_thread_sem * | sem | ) |
Increment the semaphore value. This should always succeed.
| sem | Semaphore to increment |
| gint mesh_thread_sem_post_delayed | ( | mesh_thread_sem * | sem | ) |
Increment the semaphore value after the next consume call. This uses an implicit increment-memcpy operation in the kernel perform_delayed_actions() function that is activated when the src and dest of memcpy is equal. Since memcpy() does not support equal src and dest addresses, this was special case was used to minimize changes in the code.
| sem | Semaphore to increment |
| gint mesh_thread_sem_trywait | ( | mesh_thread_sem * | sem | ) |
Attempt to decrement the semaphore. Return -1 if the semaphore value is not greater than zero. Return 0 if the semaphore value is greater than zero and the decrement succeeds. This call does not block.
| sem | Semaphore to decrement |
| gint mesh_thread_sem_wait | ( | mesh_thread_sem * | sem | ) |
Block until the semaphore value is greater than zero, then decrement it.
| sem | Semaphore to decrement |
| void mesh_thread_set_entry | ( | mesh_thread * | cr, | |
| gchar * | key, | |||
| void * | value | |||
| ) |
Changes the current value of the specified thread entry.
| cr | Thread to set entry for | |
| key | Entry's key | |
| value | Entry's new value precond Entry must have been previously created by calling mesh_thread_create_entry() . |
| void mesh_yield | ( | ) |
Immediately returns control to the scheduler committing any outstanding lightweight consumes in the process. Useful for forcing the scheduler to run after creating new threads, etc.
1.7.1