这篇教程C++ xchg函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中xchg函数的典型用法代码示例。如果您正苦于以下问题:C++ xchg函数的具体用法?C++ xchg怎么用?C++ xchg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了xchg函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: xen_resume_notifierstatic void xen_resume_notifier(int _suspend_cancelled){ int old_state = xchg(&shutting_down, SHUTDOWN_RESUMING); BUG_ON(old_state != SHUTDOWN_SUSPEND); suspend_cancelled = _suspend_cancelled;}
开发者ID:Jinjian0609,项目名称:UVP-Tools,代码行数:6,
示例2: returninline void* Atomic::xchg_ptr(void* exchange_value, volatile void* dest) { return (void*)xchg((jint)exchange_value, (volatile jint*)dest);}
开发者ID:MuniyappanV,项目名称:jdk-source-code,代码行数:3,
示例3: rt_set_trap_handlerRT_TRAP_HANDLER rt_set_trap_handler (RT_TRAP_HANDLER handler){ return (RT_TRAP_HANDLER)xchg(&rtai_trap_handler, handler);}
开发者ID:ArcEye,项目名称:RTAI,代码行数:4,
示例4: cv_signalvoid cv_signal(cond_t *cv){ t_wakeup(); xchg(&cv->cond, 1);}
开发者ID:kachebb,项目名称:CoursePorjectCS537OS-xv6multithread,代码行数:4,
示例5: expand_fdset/* * Expand the fdset in the files_struct. Called with the files spinlock * held for write. */int expand_fdset(struct files_struct *files, int nr){ fd_set *new_openset = 0, *new_execset = 0; int error, nfds = 0; error = -EMFILE; if (files->max_fdset >= NR_OPEN || nr >= NR_OPEN) goto out; nfds = files->max_fdset; write_unlock(&files->file_lock); /* Expand to the max in easy steps */ do { if (nfds < (PAGE_SIZE * 8)) nfds = PAGE_SIZE * 8; else { nfds = nfds * 2; if (nfds > NR_OPEN) nfds = NR_OPEN; } } while (nfds <= nr); error = -ENOMEM; new_openset = alloc_fdset(nfds); new_execset = alloc_fdset(nfds); write_lock(&files->file_lock); if (!new_openset || !new_execset) goto out; error = 0; /* Copy the existing tables and install the new pointers */ if (nfds > files->max_fdset) { int i = files->max_fdset / (sizeof(unsigned long) * 8); int count = (nfds - files->max_fdset) / 8; /* * Don't copy the entire array if the current fdset is * not yet initialised. */ if (i) { memcpy (new_openset, files->open_fds, files->max_fdset/8); memcpy (new_execset, files->close_on_exec, files->max_fdset/8); memset (&new_openset->fds_bits[i], 0, count); memset (&new_execset->fds_bits[i], 0, count); } nfds = xchg(&files->max_fdset, nfds); new_openset = xchg(&files->open_fds, new_openset); new_execset = xchg(&files->close_on_exec, new_execset); write_unlock(&files->file_lock); free_fdset (new_openset, nfds); free_fdset (new_execset, nfds); write_lock(&files->file_lock); return 0; } /* Somebody expanded the array while we slept ... */out: write_unlock(&files->file_lock); if (new_openset) free_fdset(new_openset, nfds); if (new_execset) free_fdset(new_execset, nfds); write_lock(&files->file_lock); return error;}
开发者ID:nhanh0,项目名称:hah,代码行数:72,
示例6: expand_fd_arrayint expand_fd_array(struct files_struct *files, int nr){ struct file **new_fds; int error, nfds; error = -EMFILE; if (files->max_fds >= NR_OPEN || nr >= NR_OPEN) goto out; nfds = files->max_fds; write_unlock(&files->file_lock); /* * Expand to the max in easy steps, and keep expanding it until * we have enough for the requested fd array size. */ do {#if NR_OPEN_DEFAULT < 256 if (nfds < 256) nfds = 256; else#endif if (nfds < (PAGE_SIZE / sizeof(struct file *))) nfds = PAGE_SIZE / sizeof(struct file *); else { nfds = nfds * 2; if (nfds > NR_OPEN) nfds = NR_OPEN; } } while (nfds <= nr); error = -ENOMEM; new_fds = alloc_fd_array(nfds); write_lock(&files->file_lock); if (!new_fds) goto out; /* Copy the existing array and install the new pointer */ if (nfds > files->max_fds) { struct file **old_fds; int i; old_fds = xchg(&files->fd, new_fds); i = xchg(&files->max_fds, nfds); /* Don't copy/clear the array if we are creating a new fd array for fork() */ if (i) { memcpy(new_fds, old_fds, i * sizeof(struct file *)); /* clear the remainder of the array */ memset(&new_fds[i], 0, (nfds-i) * sizeof(struct file *)); write_unlock(&files->file_lock); free_fd_array(old_fds, i); write_lock(&files->file_lock); } } else { /* Somebody expanded the array while we slept ... */ write_unlock(&files->file_lock); free_fd_array(new_fds, nfds); write_lock(&files->file_lock); } error = 0;out: return error;}
开发者ID:nhanh0,项目名称:hah,代码行数:70,
示例7: sys_umaskasmlinkage long sys_umask(int mask){ mask = xchg(¤t->fs->umask, mask & S_IRWXUGO); return mask;}
开发者ID:Antonio-Zhou,项目名称:Linux-2.6.11,代码行数:5,
|