/* Linuxthreads - a simple clone()-based implementation of Posix */
/* threads for Linux. */
/* Copyright (C) 1996 Xavier Leroy ([email protected]) */
/* */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Library General Public License */
/* as published by the Free Software Foundation; either version 2 */
/* 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 Library General Public License for more details. */
/* Thread creation, initialization, and basic low-level routines */
#include <errno.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/resource.h>
#include "pthread.h"
#include "internals.h"
#include "spinlock.h"
#include "restart.h"
/* Descriptor of the initial thread */
struct _pthread_descr_struct __pthread_initial_thread = {
&__pthread_initial_thread, /* pthread_descr p_nextlive */
&__pthread_initial_thread, /* pthread_descr p_prevlive */
NULL, /* pthread_descr p_nextwaiting */
NULL, /* pthread_descr p_nextlock */
PTHREAD_THREADS_MAX, /* pthread_t p_tid */
0, /* int p_pid */
0, /* int p_priority */
&__pthread_handles[0].h_lock, /* struct _pthread_fastlock * p_lock */
0, /* int p_signal */
NULL, /* sigjmp_buf * p_signal_buf */
NULL, /* sigjmp_buf * p_cancel_buf */
0, /* char p_terminated */
0, /* char p_detached */
0, /* char p_exited */
NULL, /* void * p_retval */
0, /* int p_retval */
NULL, /* pthread_descr p_joining */
NULL, /* struct _pthread_cleanup_buffer * p_cleanup */
0, /* char p_cancelstate */
0, /* char p_canceltype */
0, /* char p_canceled */
NULL, /* int *p_errnop */
0, /* int p_errno */
NULL, /* int *p_h_errnop */
0, /* int p_h_errno */
NULL, /* char * p_in_sighandler */
0, /* char p_sigwaiting */
PTHREAD_START_ARGS_INITIALIZER, /* struct pthread_start_args p_start_args */
{NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
{NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
0, /* int p_userstack */
NULL, /* void * p_guardaddr */
0, /* size_t p_guardsize */
&__pthread_initial_thread, /* pthread_descr p_self */
0, /* Always index 0 */
0, /* int p_report_events */
{{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */
ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */
0, /* char p_woken_by_cancel */
NULL, /* struct pthread_extricate_if *p_extricate */
NULL, /* pthread_readlock_info *p_readlock_list; */
NULL, /* pthread_readlock_info *p_readlock_free; */
0 /* int p_untracked_readlock_count; */
};
/* Descriptor of the manager thread; none of this is used but the error
variables, the p_pid and p_priority fields,
and the address for identification. */
struct _pthread_descr_struct __pthread_manager_thread = {
NULL, /* pthread_descr p_nextlive */
NULL, /* pthread_descr p_prevlive */
NULL, /* pthread_descr p_nextwaiting */
NULL, /* pthread_descr p_nextlock */
0, /* int p_tid */
0, /* int p_pid */
0, /* int p_priority */
&__pthread_handles[1].h_lock, /* struct _pthread_fastlock * p_lock */
0, /* int p_signal */
NULL, /* sigjmp_buf * p_signal_buf */
NULL, /* sigjmp_buf * p_cancel_buf */
0, /* char p_terminated */
0, /* char p_detached */
0, /* char p_exited */
NULL, /* void * p_retval */
0, /* int p_retval */
NULL, /* pthread_descr p_joining */
NULL, /* struct _pthread_cleanup_buffer * p_cleanup */
0, /* char p_cancelstate */
0, /* char p_canceltype */
0, /* char p_canceled */
&__pthread_manager_thread.p_errno, /* int *p_errnop */
0, /* int p_errno */
NULL, /* int *p_h_errnop */
0, /* int p_h_errno */
NULL, /* char * p_in_sighandler */
0, /* char p_sigwaiting */
PTHREAD_START_ARGS_INITIALIZER, /* struct pthread_start_args p_start_args */
{NULL}, /* void ** p_specific[PTHREAD_KEY_1STLEVEL_SIZE] */
{NULL}, /* void * p_libc_specific[_LIBC_TSD_KEY_N] */
0, /* int p_userstack */
NULL, /* void * p_guardaddr */
0, /* size_t p_guardsize */
&__pthread_manager_thread, /* pthread_descr p_self */
1, /* Always index 1 */
0, /* int p_report_events */
{{{0, }}, 0, NULL}, /* td_eventbuf_t p_eventbuf */
ATOMIC_INITIALIZER, /* struct pthread_atomic p_resume_count */
0, /* char p_woken_by_cancel */
NULL, /* struct pthread_extricate_if *p_extricate */
NULL, /* pthread_readlock_info *p_readlock_list; */
NULL, /* pthread_readlock_info *p_readlock_free; */
0 /* int p_untracked_readlock_count; */
};
/* Pointer to the main thread (the father of the thread manager thread) */
/* Originally, this is the initial thread, but this changes after fork() */
pthread_descr __pthread_main_thread = &__pthread_initial_thread;
/* Limit between the stack of the initial thread (above) and the
stacks of other threads (below). Aligned on a STACK_SIZE boundary. */
char *__pthread_initial_thread_bos = NULL;
/* File descriptor for sending requests to the thread manager. */
/* Initially -1, meaning that the thread manager is not running. */
int __pthread_manager_request = -1;
/* Other end of the pipe for sending requests to the thread manager. */
int __pthread_manager_reader;
/* Limits of the thread manager stack */
char *__pthread_manager_thread_bos = NULL;
char *__pthread_manager_thread_tos = NULL;
/* For process-wide exit() */
int __pthread_exit_requested = 0;
int __pthread_exit_code = 0;
/* Pointers that select new or old suspend/resume functions
based on availability of rt signals. */
void (*__pthread_restart)(pthread_descr) = __pthread_restart_old;
void (*__pthread_suspend)(pthread_descr) = __pthread_suspend_old;
/* Communicate relevant LinuxThreads constants to gdb */
const int __pthread_threads_max = PTHREAD_THREADS_MAX;
cons
没有合适的资源?快使用搜索试试~ 我知道了~
glibc-linuxthreads-2.1.3.tar.gz
需积分: 1 0 下载量 22 浏览量
2024-03-04
13:07:58
上传
评论
收藏 150KB GZ 举报
温馨提示
共136个文件
c:65个
h:27个
man:20个
gnu安装包
资源推荐
资源详情
资源评论
收起资源包目录
glibc-linuxthreads-2.1.3.tar.gz (136个子文件)
README.Xfree3.2 9KB
Banner 51B
Banner 33B
pthread.c 29KB
manager.c 24KB
condvar.c 13KB
rwlock.c 11KB
signals.c 7KB
oldsemaphore.c 7KB
join.c 7KB
spinlock.c 6KB
semaphore.c 6KB
mutex.c 6KB
cancel.c 6KB
attr.c 6KB
specific.c 6KB
wrapsyscall.c 5KB
td_ta_new.c 5KB
weaks.c 5KB
td_ta_thr_iter.c 4KB
ex3.c 4KB
td_ta_event_getmsg.c 4KB
ptfork.c 3KB
ex4.c 3KB
ex2.c 3KB
td_thr_tsd.c 3KB
td_ta_map_lwp2thr.c 2KB
td_thr_get_info.c 2KB
ex5.c 2KB
td_ta_map_id2thr.c 2KB
lockfile.c 2KB
ptlongjmp.c 2KB
td_thr_event_getmsg.c 2KB
td_thr_clear_event.c 2KB
td_ta_event_addr.c 2KB
td_thr_set_event.c 2KB
td_ta_tsd_iter.c 2KB
td_ta_clear_event.c 2KB
td_ta_set_event.c 2KB
td_ta_delete.c 2KB
td_thr_validate.c 2KB
td_thr_getfpregs.c 2KB
td_thr_getgregs.c 2KB
td_thr_setfpregs.c 2KB
td_ta_get_nthreads.c 2KB
td_thr_setgregs.c 2KB
no-tsd.c 1KB
td_thr_event_enable.c 1KB
errno.c 1KB
td_ta_setconcurrency.c 1KB
td_ta_enable_stats.c 1KB
td_log.c 1KB
td_ta_get_stats.c 1KB
td_ta_reset_stats.c 1KB
td_ta_get_ph.c 1KB
td_thr_setsigpending.c 1KB
td_thr_getxregsize.c 1KB
td_thr_setxregs.c 1KB
td_thr_sigsetmask.c 1KB
td_init.c 1KB
td_thr_getxregs.c 1KB
td_thr_dbsuspend.c 1KB
td_thr_dbresume.c 1KB
td_thr_setprio.c 1KB
events.c 1KB
pt-machine.c 986B
ex1.c 972B
ex6.c 680B
ChangeLog 43KB
ChangeLog 6KB
Changes 3KB
configure 171B
configure 94B
pthread.h 20KB
internals.h 17KB
thread_db.h 15KB
libc-lock.h 8KB
useldt.h 6KB
pthreadtypes.h 4KB
posix_opt.h 3KB
spinlock.h 3KB
pt-machine.h 3KB
pt-machine.h 3KB
proc_service.h 3KB
pt-machine.h 3KB
pt-machine.h 3KB
semaphore.h 3KB
pt-machine.h 2KB
pt-machine.h 2KB
local_lim.h 2KB
queue.h 2KB
pt-machine.h 2KB
thread_dbP.h 2KB
pt-machine.h 2KB
libc-tsd.h 2KB
pt-machine.h 2KB
stdio-lock.h 2KB
sigthread.h 1KB
restart.h 1KB
semaphore.h 36B
共 136 条
- 1
- 2
资源评论
程序员Chino的日记
- 粉丝: 2875
- 资源: 4万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功