📄 makecontext.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>makecontext</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_007_487"> </a>NAME</h4><blockquote>makecontext, swapcontext - manipulate user contexts</blockquote><h4><a name = "tag_000_007_488"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="ucontext.h.html">ucontext.h</a>>void makecontext(ucontext_t *<i>ucp</i>, (void *<i>func</i>)(), int <i>argc</i>, ...);int swapcontext(ucontext_t *<i>oucp</i>, const ucontext_t *<i>ucp</i>);</code></pre></blockquote><h4><a name = "tag_000_007_489"> </a>DESCRIPTION</h4><blockquote>The<i>makecontext()</i>function modifies the context specified by <i>ucp</i>,which has been initialised using<i><a href="getcontext.html">getcontext()</a></i>.When this context is resumed using<i><a href="swapcontext.html">swapcontext()</a></i>or<i><a href="setcontext.html">setcontext()</a></i>,program execution continues by calling<i>func</i>,passing it the arguments that follow <i>argc</i> in the<i>makecontext()</i>call.<p>Before a call is made to<i>makecontext()</i>,the context being modified should have a stack allocated for it. The value of<i>argc</i> must match the number of integer arguments passed to<i>func</i>,otherwise the behaviour is undefined.<p>The <i>uc_link</i> member is used to determine the context that will beresumed when the context being modified by<i>makecontext()</i>returns. The <i>uc_link</i> member should be initialised prior to the call to<i>makecontext()</i>.<p>The<i><a href="swapcontext.html">swapcontext()</a></i>function saves the current context in the context structure pointed to by<i>oucp</i>and sets the context to the context structure pointed to by<i>ucp</i>.</blockquote><h4><a name = "tag_000_007_490"> </a>RETURN VALUE</h4><blockquote>On successful completion,<i><a href="swapcontext.html">swapcontext()</a></i>returns 0. Otherwise, -1 is returned and<i>errno</i> is set to indicate the error.</blockquote><h4><a name = "tag_000_007_491"> </a>ERRORS</h4><blockquote>The<i><a href="swapcontext.html">swapcontext()</a></i>function will fail if:<dl compact><dt>[ENOMEM]<dd>The <i>ucp</i> argument does not have enough stack left to complete theoperation.</dl></blockquote><h4><a name = "tag_000_007_492"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_493"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_494"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_007_495"> </a>SEE ALSO</h4><blockquote><i><a href="exit.html">exit()</a></i>,<i><a href="getcontext.html">getcontext()</a></i>,<i><a href="sigaction.html">sigaction()</a></i>,<i><a href="sigprocmask.html">sigprocmask()</a></i>,<i><a href="ucontext.h.html"><ucontext.h></a></i>.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -