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

magine_signal_destroy

void *magine_signal_destroy(void *signal);

Description: Destroys a signal blocker

imagine_signal_wait

boolean imagine_signal_wait(void *signal);

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.