/* Copyright (C) 2008 Andreas Baumann This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #ifndef WOLF_THREADS_H #define WOLF_THREADS_H /** * @addtogroup wolf_threading Threading support * @{ */ /** * @file threads.h * @brief Portable thread functions * @author Andreas Baumann */ #ifdef __cplusplus extern "C" { #endif #include "port/sys.h" #include "errors.h" #ifdef HAVE_PTHREADS #include /* for thread functions */ #define WOLF_THREAD_RETURN_DECL void * #define WOLF_THREAD_RETURN return NULL; typedef pthread_t wolf_thread_t; typedef void *( *wolf_thread_func_t )( void * ); #endif /* HAVE_PTHREADS */ #ifdef _WIN32 #define WIN32_MEAN_AND_LEAN #include #define WOLF_THREAD_RETURN_DECL unsigned #define WOLF_THREAD_RETURN return 0; typedef uintptr_t wolf_thread_t; typedef void ( *wolf_thread_func_t )( void * ); #endif /* _WIN32 */ wolf_error_t wolf_thread_create( wolf_thread_t *thread, wolf_thread_func_t func, void *data ); wolf_error_t wolf_thread_join( wolf_thread_t *thread ); #ifdef __cplusplus } #endif /** @} */ /* @addtogroup wolf_threading */ #endif /* ifndef WOLF_THREADS_H */