This repository has been archived on 2026-04-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bhlib-old/src/thread_null.c

372 lines
7.9 KiB
C
Raw Normal View History

#include <bh/internal/thread.h>
/**
* \ingroup thread
* \{
*/
/**
* Creates the thread object with the given \a task.
*
* \warning This function can be implemented either as a macro or as a function.
*
* \param task Pointer to the task object
*
* \return On success, returns the pointer to the new queue object.
* \return On failure, returns a null pointer.
*/
bh_thread_t *bh_thread_new(bh_task_t *task)
{
(void)task;
return NULL;
}
/**
* Initializes the \a thread object with the given \a task.
*
* \warning This is an internal function.
* \warning This function can be implemented either as a macro or as a function.
*
* \param thread Pointer to the thread object
* \param task Pointer to the task object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_thread_init(bh_thread_t *thread,
bh_task_t *task)
{
(void)thread;
(void)task;
return BH_NO_IMPL;
}
/**
* Joins the \a thread.
*
* If thread was created with bh_thread_new, this function also frees the \a
* thread object.
*
* \param thread Pointer to the thread object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_thread_join(bh_thread_t *thread)
{
(void)thread;
return BH_NO_IMPL;
}
/**
* Detaches the \a thread.
*
* If thread was created with bh_thread_new, this function also frees the \a
* thread object.
*
* \param thread Pointer to the thread object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_thread_detach(bh_thread_t *thread)
{
(void)thread;
return BH_NO_IMPL;
}
/**
* Initializes the \a mutex object.
*
* \warning This is an internal function.
*
* \param mutex Pointer to the mutex object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_mutex_init(bh_mutex_t *mutex)
{
(void)mutex;
return BH_NO_IMPL;
}
/**
* Destroyes the \a mutex object.
*
* \param mutex Pointer to the mutex object
*
* \warning This is an internal function.
*/
void bh_mutex_destroy(bh_mutex_t *mutex)
{
(void)mutex;
}
/**
* Locks the \a mutex object.
*
* \param mutex Pointer to the mutex object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_mutex_lock(bh_mutex_t *mutex)
{
(void)mutex;
return BH_NO_IMPL;
}
/**
* Tries to lock the \a mutex object.
*
* \param mutex Pointer to the mutex object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_mutex_try_lock(bh_mutex_t *mutex)
{
(void)mutex;
return BH_NO_IMPL;
}
/**
* Unlocks the \a mutex object.
*
* \param mutex Pointer to the mutex object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_mutex_unlock(bh_mutex_t *mutex)
{
(void)mutex;
return BH_NO_IMPL;
}
/**
* Initilizes the \a semaphore object with specified \a count value.
*
* \warning This is an internal function.
*
* \param semaphore Pointer to the semaphore object
* \param count Initial semaphore value
*
* \return On success, returns zero.
* \return On failure, returns error code.
*
* \note Guranteed maximum \a count value is 32767.
*/
int bh_semaphore_init(bh_semaphore_t *semaphore, int count)
{
(void)semaphore;
(void)count;
return BH_NO_IMPL;
}
/**
* Destroyes the \a semaphore object.
*
* \warning This is an internal function.
*
* \param semaphore Pointer to the semaphore object
*/
void bh_semaphore_destroy(bh_semaphore_t *semaphore)
{
(void)semaphore;
}
/**
* Posts (increases value of) the \a semaphore.
*
* \param semaphore Pointer to the semaphore object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_semaphore_post(bh_semaphore_t *semaphore)
{
(void)semaphore;
return BH_NO_IMPL;
}
/**
* Waits (decreases value of) the \a semaphore.
*
* \param semaphore Pointer to the semaphore object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_semaphore_wait(bh_semaphore_t *semaphore)
{
(void)semaphore;
return BH_NO_IMPL;
}
/**
* Waits (decreases value of) the \a semaphore for the specified \a timeout
* amount of milliseconds.
*
* \param semaphore Pointer to the semaphore object
* \param timeout Number of milliseconds to wait for
*
* \return On success, returns zero.
* \return On failure or timeout, returns error code.
*/
int bh_semaphore_wait_for(bh_semaphore_t *semaphore,
unsigned long timeout)
{
(void)semaphore;
return BH_NO_IMPL;
}
/**
* Tries to waits (decrease value of) the \a semaphore.
*
* \param semaphore Pointer to the semaphore object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_semaphore_try_wait(bh_semaphore_t *semaphore)
{
(void)semaphore;
return BH_NO_IMPL;
}
/**
* Initializes the condition variable object \a cond.
*
* \warning This is an internal function.
*
* \param cond Pointer to the condition variable
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_cond_init(bh_cond_t *cond)
{
(void)cond;
return BH_NO_IMPL;
}
/**
* Destroyes the condition variable object \a cond.
*
* \param cond Pointer to the condition variable object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*
* \warning This is an internal function.
*/
void bh_cond_destroy(bh_cond_t *cond)
{
(void)cond;
}
/**
* Waits on the condition variable \a cond with specified \a mutex.
*
* \param cond Pointer to the condition variable object
* \param mutex Pointer to the mutex object
*
* \return On success, returns zero.
* \return ON failure, returns error code.
*/
int bh_cond_wait(bh_cond_t *cond,
bh_mutex_t *mutex)
{
(void)cond;
(void)mutex;
return BH_NO_IMPL;
}
/**
* Waits on the condition variable \a cond with specified \a mutex for the
* specified \a timeout amount of milliseconds.
*
* \param cond Pointer to the condition variable object
* \param mutex Pointer to the mutex object
* \param timeout Number of milliseconds to wait for
*
* \return On success, returns zero.
* \return On failure or timeout, returns error code.
*/
int bh_cond_wait_for(bh_cond_t *cond,
bh_mutex_t *mutex,
unsigned long timeout)
{
(void)cond;
(void)mutex;
(void)timeout;
return BH_NO_IMPL;
}
/**
* Signals (notifies) one waiting thread on the condition variable \a cond.
*
* \param cond Pointer to the condition variable object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_cond_signal(bh_cond_t *cond)
{
(void)cond;
return BH_NO_IMPL;
}
/**
* Signals (notifies) all waiting threads on the condition variable \a cond.
*
* \param cond Pointer to the condition variable object
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_cond_broadcast(bh_cond_t *cond)
{
(void)cond;
return BH_NO_IMPL;
}
/**
* Creates the thread pool object with specified \a size amount of threads.
*
* \param size Number of threads in the thread pool
*
* \return On success, returns pointer to the new thread pool object.
* \return On failure, returns null pointer.
*/
bh_thread_pool_t *bh_thread_pool_new(size_t size)
{
(void)size;
return NULL;
}
/**
* Initilizes the thread \a pool object with specified \a size amount of
* threads.
*
* \warning This is an internal function.
*
* \param pool Pointer to the thread pool object
* \param size Number of threads in the thread pool
*
* \return On success, returns zero.
* \return On failure, returns error code.
*/
int bh_thread_pool_init(bh_thread_pool_t *pool,
size_t size)
{
(void)pool;
(void)size;
return BH_NO_IMPL;
}
/**
* \}
*/