/*
* Create a thread to periodically resume suspended I/O.
*/
- VERIFY3P((resume_thread = thread_create(NULL, 0, ztest_resume_thread,
- spa, TS_RUN, NULL, 0, 0)), !=, NULL);
+ VERIFY3P((resume_thread = zk_thread_create(NULL, 0,
+ (thread_func_t)ztest_resume_thread, spa, TS_RUN, NULL, 0, 0,
+ PTHREAD_CREATE_JOINABLE)), !=, NULL);
/*
* Set a deadman alarm to abort() if we hang.
if (t < zopt_datasets && ztest_dataset_open(zs, t) != 0)
return;
- VERIFY3P(thread = thread_create(NULL, 0, ztest_thread,
- (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0), !=, NULL);
+ VERIFY3P(thread = zk_thread_create(NULL, 0,
+ (thread_func_t)ztest_thread,
+ (void *)(uintptr_t)t, TS_RUN, NULL, 0, 0,
+ PTHREAD_CREATE_JOINABLE), !=, NULL);
tid[t] = thread->t_tid;
}
#define thread_exit zk_thread_exit
#define thread_create(stk, stksize, func, arg, len, pp, state, pri) \
zk_thread_create(stk, stksize, (thread_func_t)func, arg, \
- len, NULL, state, pri)
+ len, NULL, state, pri, PTHREAD_CREATE_DETACHED)
#define thread_join(t) zk_thread_join(t)
#define newproc(f,a,cid,pri,ctp,pid) (ENOSYS)
extern void zk_thread_exit(void);
extern kthread_t *zk_thread_create(caddr_t stk, size_t stksize,
thread_func_t func, void *arg, size_t len,
- proc_t *pp, int state, pri_t pri);
+ proc_t *pp, int state, pri_t pri, int detachstate);
extern void zk_thread_join(kt_did_t tid);
#define kpreempt_disable() ((void)0)
kthread_t *
zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func, void *arg,
- size_t len, proc_t *pp, int state, pri_t pri)
+ size_t len, proc_t *pp, int state, pri_t pri, int detachstate)
{
kthread_t *kt;
pthread_attr_t attr;
VERIFY3S(pthread_attr_init(&attr), ==, 0);
VERIFY3S(pthread_attr_setstacksize(&attr, stack), ==, 0);
VERIFY3S(pthread_attr_setguardsize(&attr, PAGESIZE), ==, 0);
+ VERIFY3S(pthread_attr_setdetachstate(&attr, detachstate), ==, 0);
VERIFY3S(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt),
==, 0);