本文整理汇总了C++中GET_THREAD_ID函数的典型用法代码示例。如果您正苦于以下问题:C++ GET_THREAD_ID函数的具体用法?C++ GET_THREAD_ID怎么用?C++ GET_THREAD_ID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GET_THREAD_ID函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fetch_regs
static void
fetch_regs (struct regcache *regcache)
{
int ret, regno, tid;
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to fetch general registers."));
return;
}
for (regno = ARM_A1_REGNUM; regno < ARM_PC_REGNUM; regno++)
regcache_raw_supply (regcache, regno, (char *) ®s[regno]);
if (arm_apcs_32)
regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_CPSR_GREGNUM]);
else
regcache_raw_supply (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
regs[ARM_PC_REGNUM] = gdbarch_addr_bits_remove
(get_regcache_arch (regcache), regs[ARM_PC_REGNUM]);
regcache_raw_supply (regcache, ARM_PC_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
}
示例2: fetch_fpregs
static void
fetch_fpregs (struct regcache *regcache)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
/* Read the floating point state. */
ret = ptrace (PT_GETFPREGS, tid, 0, fp);
if (ret < 0)
{
warning (_("Unable to fetch the floating point registers."));
return;
}
/* Fetch fpsr. */
regcache_raw_supply (regcache, ARM_FPS_REGNUM,
fp + NWFPE_FPSR_OFFSET);
/* Fetch the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
supply_nwfpe_register (regcache, regno, fp);
}
示例3: store_fpregs
static void
store_fpregs (const struct regcache *regcache)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
/* Read the floating point state. */
ret = ptrace (PT_GETFPREGS, tid, 0, fp);
if (ret < 0)
{
warning (_("Unable to fetch the floating point registers."));
return;
}
/* Store fpsr. */
if (regcache_valid_p (regcache, ARM_FPS_REGNUM))
regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
/* Store the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
if (regcache_valid_p (regcache, regno))
collect_nwfpe_register (regcache, regno, fp);
ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
if (ret < 0)
{
warning (_("Unable to store floating point registers."));
return;
}
}
示例4: store_vfp_regs
static void
store_vfp_regs (const struct regcache *regcache)
{
char regbuf[VFP_REGS_SIZE];
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
ret = ptrace (PTRACE_GETVFPREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to fetch VFP registers (for update)."));
return;
}
for (regno = 0; regno < arm_linux_vfp_register_count; regno++)
regcache_raw_collect (regcache, regno + ARM_D0_REGNUM,
(char *) regbuf + regno * 8);
regcache_raw_collect (regcache, ARM_FPSCR_REGNUM,
(char *) regbuf + 32 * 8);
ret = ptrace (PTRACE_SETVFPREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to store VFP registers."));
return;
}
}
示例5: fetch_wmmx_regs
static void
fetch_wmmx_regs (struct regcache *regcache)
{
char regbuf[IWMMXT_REGS_SIZE];
int ret, regno, tid;
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
ret = ptrace (PTRACE_GETWMMXREGS, tid, 0, regbuf);
if (ret < 0)
{
warning (_("Unable to fetch WMMX registers."));
return;
}
for (regno = 0; regno < 16; regno++)
regcache_raw_supply (regcache, regno + ARM_WR0_REGNUM,
®buf[regno * 8]);
for (regno = 0; regno < 2; regno++)
regcache_raw_supply (regcache, regno + ARM_WCSSF_REGNUM,
®buf[16 * 8 + regno * 4]);
for (regno = 0; regno < 4; regno++)
regcache_raw_supply (regcache, regno + ARM_WCGR0_REGNUM,
®buf[16 * 8 + 2 * 4 + regno * 4]);
}
示例6: store_regs
static void
store_regs (const struct regcache *regcache)
{
int ret, regno, tid;
elf_gregset_t regs;
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
/* Fetch the general registers. */
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to fetch general registers."));
return;
}
for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
{
if (REG_VALID == regcache_register_status (regcache, regno))
regcache_raw_collect (regcache, regno, (char *) ®s[regno]);
}
if (arm_apcs_32 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM))
regcache_raw_collect (regcache, ARM_PS_REGNUM,
(char *) ®s[ARM_CPSR_GREGNUM]);
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to store general registers."));
return;
}
}
示例7: broadcast_internal
//internal version
template <class T> T broadcast_internal(T in,int rank_from,MPI_Datatype type)
{
T out;
GET_THREAD_ID();
if(IS_MASTER_THREAD) MPI_Bcast(&in,1,type,rank_from,MPI_COMM_WORLD);
THREAD_BROADCAST(out,in);
return out;
}
示例8: arm_linux_read_description
static const struct target_desc *
arm_linux_read_description (struct target_ops *ops)
{
CORE_ADDR arm_hwcap = 0;
if (have_ptrace_getregset == TRIBOOL_UNKNOWN)
{
elf_gregset_t gpregs;
struct iovec iov;
int tid = GET_THREAD_ID (inferior_ptid);
iov.iov_base = &gpregs;
iov.iov_len = sizeof (gpregs);
/* Check if PTRACE_GETREGSET works. */
if (ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov) < 0)
have_ptrace_getregset = TRIBOOL_FALSE;
else
have_ptrace_getregset = TRIBOOL_TRUE;
}
if (target_auxv_search (ops, AT_HWCAP, &arm_hwcap) != 1)
{
return ops->beneath->to_read_description (ops->beneath);
}
if (arm_hwcap & HWCAP_IWMMXT)
return tdesc_arm_with_iwmmxt;
if (arm_hwcap & HWCAP_VFP)
{
int pid;
char *buf;
const struct target_desc * result = NULL;
/* NEON implies VFPv3-D32 or no-VFP unit. Say that we only support
Neon with VFPv3-D32. */
if (arm_hwcap & HWCAP_NEON)
result = tdesc_arm_with_neon;
else if ((arm_hwcap & (HWCAP_VFPv3 | HWCAP_VFPv3D16)) == HWCAP_VFPv3)
result = tdesc_arm_with_vfpv3;
else
result = tdesc_arm_with_vfpv2;
/* Now make sure that the kernel supports reading these
registers. Support was added in 2.6.30. */
pid = ptid_get_lwp (inferior_ptid);
errno = 0;
buf = alloca (VFP_REGS_SIZE);
if (ptrace (PTRACE_GETVFPREGS, pid, 0, buf) < 0
&& errno == EIO)
result = NULL;
return result;
}
return ops->beneath->to_read_description (ops->beneath);
}
示例9: store_register
static void
store_register (const struct regcache *regcache, int regno)
{
int ret, tid;
elf_gregset_t regs;
if (REG_VALID != regcache_register_status (regcache, regno))
return;
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
/* Get the general registers from the process. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = ®s;
iov.iov_len = sizeof (regs);
ret = ptrace (PTRACE_GETREGSET, tid, NT_PRSTATUS, &iov);
}
else
ret = ptrace (PTRACE_GETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to fetch general registers."));
return;
}
if (regno >= ARM_A1_REGNUM && regno <= ARM_PC_REGNUM)
regcache_raw_collect (regcache, regno, (char *) ®s[regno]);
else if (arm_apcs_32 && regno == ARM_PS_REGNUM)
regcache_raw_collect (regcache, regno,
(char *) ®s[ARM_CPSR_GREGNUM]);
else if (!arm_apcs_32 && regno == ARM_PS_REGNUM)
regcache_raw_collect (regcache, ARM_PC_REGNUM,
(char *) ®s[ARM_PC_REGNUM]);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = ®s;
iov.iov_len = sizeof (regs);
ret = ptrace (PTRACE_SETREGSET, tid, NT_PRSTATUS, &iov);
}
else
ret = ptrace (PTRACE_SETREGS, tid, 0, ®s);
if (ret < 0)
{
warning (_("Unable to store general register."));
return;
}
}
示例10: store_fpregs
static void
store_fpregs (const struct regcache *regcache)
{
int ret, regno, tid;
gdb_byte fp[ARM_LINUX_SIZEOF_NWFPE];
/* Get the thread id for the ptrace call. */
tid = GET_THREAD_ID (inferior_ptid);
/* Read the floating point state. */
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
elf_fpregset_t fpregs;
struct iovec iov;
iov.iov_base = &fpregs;
iov.iov_len = sizeof (fpregs);
ret = ptrace (PTRACE_GETREGSET, tid, NT_FPREGSET, &iov);
}
else
ret = ptrace (PT_GETFPREGS, tid, 0, fp);
if (ret < 0)
{
warning (_("Unable to fetch the floating point registers."));
return;
}
/* Store fpsr. */
if (REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM))
regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
/* Store the floating point registers. */
for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
if (REG_VALID == regcache_register_status (regcache, regno))
collect_nwfpe_register (regcache, regno, fp);
if (have_ptrace_getregset == TRIBOOL_TRUE)
{
struct iovec iov;
iov.iov_base = &fp;
iov.iov_len = ARM_LINUX_SIZEOF_NWFPE;
ret = ptrace (PTRACE_SETREGSET, tid, NT_FPREGSET, &iov);
}
else
ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
if (ret < 0)
{
warning (_("Unable to store floating point registers."));
return;
}
}
示例11: thread_pool_stop
//delete the thread pool
void thread_pool_stop()
{
GET_THREAD_ID();
//check to be thread 0
if(thread_id!=0) crash("only thread 0 can stop the pool");
//pass a NULL order
start_threaded_function(NULL,"");
}
示例12: ranks_abort
//abort
void ranks_abort(int err)
{
#ifdef USE_MPI
GET_THREAD_ID();
printf("thread %d on rank %d aborting\n",THREAD_ID,rank);
MPI_Abort(MPI_COMM_WORLD,0);
#else
exit(0);
#endif
}
示例13: thread_pool_unlock
//unlock the thread pool
void thread_pool_unlock()
{
THREAD_BARRIER_FORCE();
#ifdef THREAD_DEBUG
GET_THREAD_ID();
if(rank==0 && VERBOSITY_LV3) printf("thread %d unlocking the pool\n",thread_id);
#endif
thread_pool_locked=false;
cache_flush();
}
示例14: ___rouent2
void ___rouent2(struct s1 *p) {
uint32_t tid;
uint64_t time;
/* -- if not yet initialized, initialize VampirTrace -- */
if (rou_init)
{
rou_init = 0;
vt_open();
}
/* -- if VampirTrace already finalized, return -- */
if ( !vt_is_alive ) return;
/* -- get calling thread id -- */
GET_THREAD_ID(tid);
VT_SUSPEND_MALLOC_TRACING(tid);
time = vt_pform_wtime();
if (!p->isseen)
{
char* rname = p->rout;
char* modpos;
/* fix opari output file names */
if ( (modpos = strstr(p->file, ".mod.")) != NULL )
{
strcpy(modpos, modpos+4);
}
#if (defined(VT_MT) || defined(VT_HYB))
VTTHRD_LOCK_IDS();
if (!p->isseen)
{
p->fid = vt_def_scl_file(tid, p->file);
p->rid = vt_def_region(tid, rname, p->fid, p->lineno,
VT_NO_LNO, NULL, VT_FUNCTION);
p->isseen = 1;
}
VTTHRD_UNLOCK_IDS();
#else /* VT_MT || VT_HYB */
p->fid = vt_def_scl_file(tid, p->file);
p->rid = vt_def_region(tid, rname, p->fid, p->lineno,
VT_NO_LNO, NULL, VT_FUNCTION);
p->isseen = 1;
#endif /* VT_MT || VT_HYB */
}
/* write enter trace record */
vt_enter(tid, &time, p->rid);
VT_RESUME_MALLOC_TRACING(tid);
}
示例15: THREADABLE_FUNCTION_6ARG
THREADABLE_FUNCTION_6ARG(fft4d, complex*,out, complex*,in, int*,ext_dirs, int,ncpp, double,sign, int,normalize)
{
GET_THREAD_ID();
//first of all put in to out
if(out!=in) vector_copy(out,in);
//list all dirs
int dirs[NDIM],ndirs=0;
for(int mu=0;mu<NDIM;mu++) if(ext_dirs[mu]) dirs[ndirs++]=mu;
verbosity_lv2_master_printf("Going to FFT: %d dimensions in total\n",ndirs);
if(ndirs)
{
//allocate buffer
complex *buf=nissa_malloc("buf",max_locd_size*ncpp,complex);
//allocate plans
fftw_plan *plans=nissa_malloc("plans",ndirs,fftw_plan);
if(IS_MASTER_THREAD)
for(int idir=0;idir<ndirs;idir++)
plans[idir]=fftw_plan_many_dft(1,glb_size+dirs[idir],ncpp,buf,NULL,ncpp,1,buf,NULL,ncpp,1,sign,FFTW_ESTIMATE);
THREAD_BARRIER();
//transpose each dir in turn and take fft
for(int idir=0;idir<ndirs;idir++)
{
int mu=dirs[idir];
verbosity_lv2_master_printf("FFT-ing dimension %d/%d=%d\n",idir+1,ndirs,mu);
remap_lx_vector_to_locd(buf,out,ncpp*sizeof(complex),mu);
//makes all the fourier transform
NISSA_PARALLEL_LOOP(ioff,0,locd_perp_size_per_dir[mu])
fftw_execute_dft(plans[idir],buf+ioff*glb_size[mu]*ncpp,buf+ioff*glb_size[mu]*ncpp);
THREAD_BARRIER();
remap_locd_vector_to_lx(out,buf,ncpp*sizeof(complex),mu);
}
//destroy plans
if(IS_MASTER_THREAD) for(int idir=0;idir<ndirs;idir++) fftw_destroy_plan(plans[idir]);
//put normaliisation
if(normalize)
{
double norm=glb_size[dirs[0]];
for(int idir=1;idir<ndirs;idir++) norm*=glb_size[idir];
double_vector_prod_double((double*)out,(double*)out,1/norm,2*ncpp*loc_vol);
}
nissa_free(buf);
nissa_free(plans);
}
}