BLOG ARTICLE 분류 전체보기 | 226 ARTICLE FOUND
- 2009.09.10 ALTIBASE Windows 매뉴얼
- 2009.09.01 VC++ Thread 심플 클래스
- 2009.09.01 소스포지에서 발견한 쓰레드 풀 소스...
- 2009.09.01 ORA-01045: user ... lacks CREATE SESSION privilege; logon denied 해결법
- 2009.09.01 UNIX pthread 이용시 쓰레드 Timeout 거는 방법
#ifdef WIN32
class Thread
{
public:
Thread ( DWORD (WINAPI * pFun) (void* arg), void* pArg)
{
_handle = CreateThread (
0, // Security attributes
0, // Stack size
pFun,
pArg,
CREATE_SUSPENDED,
&_tid);
}
~Thread () { CloseHandle (_handle); }
void Resume () { ResumeThread (_handle); }
void WaitForDeath (int nTimeOut)
{
if (nTimeOut==INFINITE) WaitForSingleObject (_handle,INFINITE);
else WaitForSingleObject (_handle, nTimeOut*1000);
}
int nTimeOut;
private:
HANDLE _handle;
DWORD _tid; // thread id
};
#endif
사용방법
thread_func_args pthread_args(tcp_proc,socket_array[nConnection_Count-1]);
Thread thr(&CTCPComm::ValidateData_Client,&pthread_args);
thr.nTimeOut=3;
thr.Resume();
thr.WaitForDeath();
윈도우즈에서 Thread Hang이 사라짐..퍼포먼스 그런대로 괜찮음...
실소스에 적용해보니 아주조금 퍼포먼스는 좋긴하나..그냥 그렇게 월등해보이진 않음...
참고용으로만 사용..
ORA-01045: user ... lacks CREATE SESSION privilege; logon denied 해결법
프로그래밍/DataBase 2009. 9. 1. 22:49This error is thrown if a user wants to log on a database but lacks the create session system privilege. In order to give someone this privilege, use:
grant create session to the_user;
#include "PThread_TimeOut.h"
...
status = pthread_create(&hThread,
NULL,
&CTCPComm::ValidateData_Server,
&pthread_args);
pthread_join_timeout(hThread, 2000) ;
pthread_detach(hThread);
...