Multi Treading

Imagine has full thread supprot that lets you create threads and thread safe Mutex locks.

imagine_mutex_create

void *imagine_mutex_create();

Description: Creates a Mutex. Mutex locks are unlocked when created.

imagine_mutex_lock

void imagine_mutex_lock(void *mutex);

Description: Lock a mutex. If the lock is already locked, the thread will wait on the lock until the lock is unlocked so that it can lock it

imagine_mutex_lock_try

boolean imagine_mutex_lock_try(void *mutex);

Description: The thread will atempt to lock the thread, if the lock is already locked if will returne FALSE and fail, If is is not locked, it will lock the mutex and return TRUE

imagine_mutex_unlock

void imagine_mutex_unlock(void *mutex);

Description: Un locks the Mutex

imagine_mutex_destroy

void imagine_mutex_destroy(void *mutex);

Description: Destroys the mutex

imagine_signal_create

void *imagine_signal_create();

Description: Creates a signal bocker

imagine_signal_destroy

void imagine_signal_destroy(void *signal);

Description: Destroys a signal blocker

imagine_signal_wait

boolean imagine_signal_wait(void *signal, void *mutex);

Description: Sets a thread to wait on the blocker for another thread to a activate it.

imagine_signal_activate

boolean imagine_signal_activate(void *signal);

Description: Activates the blocker so that one or more threads waiting on the signal will be released

imagine_thread

void imagine_thread(void (*func)(void *data), void *data);

Description: launches a thread that will execute the function pointer. The void pointer will be given as i parameter. Onec the function returns the thread will be deleted.

imagine_mutex_create_debug

void *imagine_mutex_create_debug();

Description: debug version of magine_mutex_create

imagine_signal_destroy_debug

void imagine_signal_destroy_debug(void *mutex, char *file, uint line);

Description: debug version of magine_mutex_destroy

imagine_mutex_lock_debug

void imagine_mutex_lock_debug(void *mutex, char *file, uint line);

Description: debug version of imagine_mutex_lock

imagine_mutex_lock_try_debug

boolean imagine_mutex_lock_try_debug(void *mutex, char *file, uint line);

Description: debug version of imagine_mutex_lock_try

imagine_mutex_unlock_debug

void imagine_mutex_unlock_debug(void *mutex, char *file, uint line);

Description: debug version of imagine_mutex_unlock

imagine_signal_wait_debug

void imagine_signal_wait_debug(void *signal, void *mutex, char *file, uint line);

Description: debug version of imagine_mutex_unlock

imagine_mutex_is_locked_debug

boolean imagine_mutex_is_locked_debug(void *mutex);

Description: check if a lock is locked

imagine_mutex_print_debug

void imagine_mutex_print_debug();

Description: prints out all currently locked mutexes and where they have been locked.