황승환 님이 쓰신 글 :
: 안녕하세요.
:
: 다중스레드를 써서 프로그램을 작성중입니다.
: 구동중인 스레드들의 중요도는 동등하고 다만 이들들의 주기가 다릅니다.
: 이럴경우 각 스레드들의 우선순위를 어떻게 정해야 하나요?
: 주기가 길수록 우선순위를 낮춰잡아야 할지 아니면 그 반대로 해야할지,
: 아니면 주기와는 상관없이 구현기능이 동등히 중요하면 이들들의 우선순위를
: 같게 설정해도 괜찮은지????
:
: 답변 부탁드릴께여.
:
:
안녕하세요 스페로 입니다...
스레드 오브젝트를 이용해서 스레드를 구현하신다면 다음과 같이 하면 됩니다...
저는 C++빌더6에서 스레드 오브젝트를 이용해서 플밍을 해보았거든요..
CLX에플리케이션에도 마찬가지로 스레드 오브젝트는 잇고요
카일릭스에도 있답니다..
아래에 소스는 스레드 오브젝트의 뼈대인대요.. 여기에서 사용자가 스레드가 해야할일을
기술한답니다..
아래 소스를 보시면 아시겠지만..
스레드의 생성자 부분에 프아이어티를 설정 할수 있습니다..
Priority =tpIdle; 이런식으로...
아래에는 CLX 레퍼런스에서 어떤것들이 잇나를 주석으로 붙여 봣음다...
그럼^^;
//---------------------------------------------------------------------------
#include <clx.h>
#pragma hdrstop
#include "Unit2.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
__fastcall Test::Test(bool CreateSuspended)
: TThread(CreateSuspended)
{
Priority =tpIdle;
/*
Values Meaning
tpIdle The thread executes only when the system is idle. The system will not interrupt other threads to execute a thread with tpIdle priority.
tpLowest The thread's priority is two points below normal.
tpLower The thread's priority is one point below normal.
tpNormal The thread has normal priority.
tpHigher The thread's priority is one point above normal.
tpHighest The thread's priority is two points above normal.
tpTimeCritical The thread gets highest priority.
*/
}
//---------------------------------------------------------------------------
void __fastcall Test::Execute()
{
//---- Place thread code here ----
}
//---------------------------------------------------------------------------
|