- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
当我执行下面的代码时——:
#include<iostream>
#include<windows.h>
using namespace std;
int main()
{
cout << GetCurrentProcessId() << endl;
cout << GetCurrentThreadId() << endl;
}
我得到以下输出-:
1160
4316
我的问题是-:
我在 Windows 7 上使用 C++14 和 TDM-GCC 4.9.1 编译器。
最佳答案
由于您使用的是 Windows,因此 MSDN 必须这样说:
An application consists of one or more processes. A process, in the simplest terms, is an executing program. One or more threads run in the context of the process. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the process code, including parts currently being executed by another thread.
Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. Threads can also have their own security context, which can be used for impersonating clients.
关于c++ - GetProcessID 与 GetThreadID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32123473/
当我执行下面的代码时——: #include #include using namespace std; int main() { cout << GetCurrentProcessId()
我使用 GetProcessID 不小心从应用程序中删除了 Win2K 兼容性. 我这样使用它,以获取已启动应用程序的主要 HWND。 ShellExecuteEx(&info); // Launch
我正在使用下面的方法 [DllImport("kernel32.dll", SetLastError=true)] static extern int GetProcessId(Int
我早些时候发布了一个发送消息问题,我们得出的结论是,从 Xchat 获取聊天窗口非常困难。我现在已经转移到 ThrashIRC 并使用 spy++ 能够找到聊天窗口(突出显示): 如您所见,它确实有一
我在调试 Android 项目时遇到问题。我可以部署到设备并运行它,一切正常,但如果我尝试调试,应用程序将部署到设备并非常短暂地打开,启动画面显示但应用程序随后关闭。 我在 Visual Studio
我是一名优秀的程序员,十分优秀!