System::Threading::Thread 클래스
내용물
[
숨다
]Thread class
Thread implementation. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.
class Thread : public System::Object
메서드
| 메서드 | 설명 |
|---|---|
| Abort() | 스레드를 중단합니다. 구현되지 않음. |
| get_CurrentCulture() | 스레드 문화 정보를 가져옵니다. |
| static get_CurrentThread() | 현재 스레드를 설명하는 객체를 가져옵니다. |
| get_CurrentUICulture() | 스레드가 사용하는 사용자 인터페이스 문화 정보를 가져옵니다. |
| get_IsAlive() | 스레드가 살아 있는지 확인합니다. |
| get_IsBackground() | 스레드가 백그라운드인지 확인합니다. |
| get_IsThreadPoolThread() | 스레드가 스레드 풀에 의해 소유되는지 확인합니다. |
| get_ManagedThreadId() const | 스레드 식별자를 가져옵니다. 운영 체제에서 얻을 수 있지만, OS 스레드 식별자가 int 한도를 초과하면 스레드 ID가 겹칠 수 있습니다. |
| get_Name() | 스레드 이름을 가져옵니다. |
| get_ThreadState() | 스레드 상태를 가져옵니다. |
| static GetCurrentThreadId() | 현재 스레드의 식별자를 가져옵니다. |
| GetHashCode() const override | |
| Interrupt() | 스레드를 인터럽트합니다. 구현되지 않음. |
| Join() | 관리되는 스레드에 조인합니다. 필요에 따라 무제한 대기를 수행합니다. |
| Join(int) | 관리되는 스레드에 조인합니다. 제한된 대기를 수행합니다. |
| Join(TimeSpan) | 관리되는 스레드에 조인합니다. 제한된 대기를 수행합니다. |
| static MemoryBarrier() | 메모리 접근을 동기화합니다. |
| operator=(const Thread&) | 다른 스레드에서 TLS 데이터를 복사합니다. |
| set_CurrentCulture(const SharedPtr<Globalization::CultureInfo>&) | 스레드 문화 정보를 설정합니다. |
| set_CurrentUICulture(const SharedPtr<Globalization::CultureInfo>&) | 스레드가 사용하는 사용자 인터페이스 문화 정보를 설정합니다. |
| set_IsBackground(bool) | 스레드를 백그라운드 또는 포그라운드로 설정합니다. |
| set_Name(const System::String&) | 스레드 이름을 설정합니다. |
| static Sleep(int) | 지정된 시간 제한 동안 현재 스레드를 중지합니다. |
| static Sleep(TimeSpan) | 지정된 시간 제한 동안 현재 스레드를 중지합니다. |
| static SpinWait(int) | 특정 반복 횟수만큼 대기합니다. |
| Start() | null 인수 객체를 사용하여 스레드를 시작합니다. |
| Start(const System::SharedPtr<System::Object>&) | 스레드를 시작합니다. |
| Thread() | 생성자. |
| Thread(ThreadStart) | 생성자. |
| Thread(ParameterizedThreadStart) | 생성자. |
| Thread(Thread&) | 복사 생성자. |
| static Yield() | 스레드를 양보합니다. |
| virtual ~Thread() | 소멸자. |
비고
#include "system/threading/thread.h"
#include "system/smart_ptr.h"
int main()
{
auto thread = System::MakeObject<System::Threading::Thread>([]()
{
std::cout << "Child thread ID: " << System::Threading::Thread::GetCurrentThreadId() << std::endl;
System::Threading::Thread::Sleep(200);
});
std::cout << "Main thread ID: " << System::Threading::Thread::GetCurrentThreadId() << std::endl;
thread->Start();
thread->Join();
return 0;
}
/*
This code example produces the following output:
Main thread ID: 2
Child thread ID: 1
*/
또 보기
- Class Object
- Namespace System::Threading
- Library Aspose.Page for C++