使用pthreads,您可以为程序逻辑使用辅助线程,并使用以下命令设置其堆栈地址pthread_attr_setstack()
:
NAME
pthread_attr_setstack, pthread_attr_getstack - set/get stack
attributes in thread attributes object
SYNOPSIS
#include <pthread.h>
int pthread_attr_setstack(pthread_attr_t *attr,
void *stackaddr, size_t stacksize);
DESCRIPTION
The pthread_attr_setstack() function sets the stack address and
stack size attributes of the thread attributes object referred
to by attr to the values specified in stackaddr and stacksize,
respectively. These attributes specify the location and size
of the stack that should be used by a thread that is created
using the thread attributes object attr.
stackaddr should point to the lowest addressable byte of a buf?
fer of stacksize bytes that was allocated by the caller. The
pages of the allocated buffer should be both readable and
writable.
Run Code Online (Sandbox Code Playgroud)
我不遵循的是你如何期望通过做这样的事情来获得任何性能改进(我假设你的"快速"内存的目的是更好的性能).
归档时间: |
|
查看次数: |
387 次 |
最近记录: |