d3d33afe9f
This patch adds pthread compatibility by using libmthread. To use this with a program using pthreads, you have to replace #include <pthread> with #define _MTHREADIFY_PTHREADS #include <minix/mthreads> This also changes the initialization function to be a constructor, which is implicitly called before the call to main. This allows for conformance with pthreads, while not paying a high price by checking on each mthread_* call whether the library has been initialized or not. As mthread_init is now a constructor, it also has been set as static, and relevent calls removed from programs using it. Change-Id: I2aa375db557958d2bee9a70d285aabb990c88f00
41 lines
952 B
C
41 lines
952 B
C
#ifndef __VFS_WORKERS_H__
|
|
#define __VFS_WORKERS_H__
|
|
#include <minix/mthread.h>
|
|
|
|
#define thread_t mthread_thread_t
|
|
#define mutex_t mthread_mutex_t
|
|
#define cond_t mthread_cond_t
|
|
#define attr_t mthread_attr_t
|
|
|
|
#define yield mthread_yield
|
|
#define yield_all mthread_yield_all
|
|
|
|
#define mutex_init mthread_mutex_init
|
|
#define mutex_destroy mthread_mutex_destroy
|
|
#define mutex_lock mthread_mutex_lock
|
|
#define mutex_trylock mthread_mutex_trylock
|
|
#define mutex_unlock mthread_mutex_unlock
|
|
|
|
#define cond_init mthread_cond_init
|
|
#define cond_destroy mthread_cond_destroy
|
|
#define cond_wait mthread_cond_wait
|
|
#define cond_signal mthread_cond_signal
|
|
|
|
struct fproc;
|
|
|
|
struct worker_thread {
|
|
thread_t w_tid;
|
|
mutex_t w_event_mutex;
|
|
cond_t w_event;
|
|
struct fproc *w_fp;
|
|
message w_m_in;
|
|
message w_m_out;
|
|
int w_err_code;
|
|
message *w_fs_sendrec;
|
|
message *w_drv_sendrec;
|
|
endpoint_t w_task;
|
|
struct dmap *w_dmap;
|
|
struct worker_thread *w_next;
|
|
};
|
|
|
|
#endif
|