2010-05-18 02:18:00 +04:00
|
|
|
/*****************************************************************************\
|
|
|
|
* Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
|
|
|
|
* Copyright (C) 2007 The Regents of the University of California.
|
|
|
|
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
|
|
|
|
* Written by Brian Behlendorf <behlendorf1@llnl.gov>.
|
2008-05-26 08:38:26 +04:00
|
|
|
* UCRL-CODE-235197
|
|
|
|
*
|
2010-05-18 02:18:00 +04:00
|
|
|
* This file is part of the SPL, Solaris Porting Layer.
|
|
|
|
* For details, see <http://github.com/behlendorf/spl/>.
|
2008-05-26 08:38:26 +04:00
|
|
|
*
|
2010-05-18 02:18:00 +04:00
|
|
|
* The SPL 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 2 of the License, or (at your
|
|
|
|
* option) any later version.
|
|
|
|
*
|
|
|
|
* The SPL is distributed in the hope that it will be useful, but WITHOUT
|
2008-05-26 08:38:26 +04:00
|
|
|
* 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
|
2010-05-18 02:18:00 +04:00
|
|
|
* with the SPL. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
\*****************************************************************************/
|
2008-05-26 08:38:26 +04:00
|
|
|
|
2008-02-28 03:52:31 +03:00
|
|
|
#ifndef _SPL_THREAD_H
|
|
|
|
#define _SPL_THREAD_H
|
2008-02-26 23:36:04 +03:00
|
|
|
|
2008-02-27 22:09:51 +03:00
|
|
|
#include <linux/module.h>
|
2008-02-26 23:36:04 +03:00
|
|
|
#include <linux/mm.h>
|
|
|
|
#include <linux/spinlock.h>
|
2008-04-04 08:44:16 +04:00
|
|
|
#include <linux/kthread.h>
|
2008-03-01 03:45:59 +03:00
|
|
|
#include <sys/types.h>
|
2008-03-04 21:22:31 +03:00
|
|
|
#include <sys/sysmacros.h>
|
2008-02-26 23:36:04 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Thread interfaces
|
|
|
|
*/
|
|
|
|
#define TP_MAGIC 0x53535353
|
|
|
|
|
|
|
|
#define TS_SLEEP TASK_INTERRUPTIBLE
|
|
|
|
#define TS_RUN TASK_RUNNING
|
|
|
|
#define TS_ZOMB EXIT_ZOMBIE
|
|
|
|
#define TS_STOPPED TASK_STOPPED
|
|
|
|
|
2008-03-10 22:25:20 +03:00
|
|
|
typedef void (*thread_func_t)(void *);
|
|
|
|
|
2008-02-26 23:36:04 +03:00
|
|
|
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
|
2008-03-10 22:25:20 +03:00
|
|
|
__thread_create(stk, stksize, (thread_func_t)func, \
|
2008-04-04 08:44:16 +04:00
|
|
|
#func, arg, len, pp, state, pri)
|
2008-02-26 23:36:04 +03:00
|
|
|
#define thread_exit() __thread_exit()
|
2010-07-20 01:16:05 +04:00
|
|
|
#define thread_join(t) VERIFY(0)
|
2008-02-26 23:36:04 +03:00
|
|
|
#define curthread get_current()
|
|
|
|
|
2008-02-27 22:09:51 +03:00
|
|
|
extern kthread_t *__thread_create(caddr_t stk, size_t stksize,
|
2008-04-04 08:44:16 +04:00
|
|
|
thread_func_t func, const char *name,
|
2010-06-12 01:37:46 +04:00
|
|
|
void *args, size_t len, proc_t *pp,
|
2008-04-04 08:44:16 +04:00
|
|
|
int state, pri_t pri);
|
2008-02-27 22:09:51 +03:00
|
|
|
extern void __thread_exit(void);
|
2008-02-26 23:36:04 +03:00
|
|
|
|
2008-02-28 03:52:31 +03:00
|
|
|
#endif /* _SPL_THREAD_H */
|