Check GCHeap::FinalizerThreadCreate in clr\src\vm\gcee.cpp on how the GC
finalizer thread is created. The creation of your helper thread should
be similar. It can be something like:
MyThread = SetupUnstartedThread();
h = MyThread->CreateNewThread(4096, &myThread, NULL, &newThreadId);
if (!h) { ... fail ... }
MyThread ->SetThreadId(newThreadId);
dwRet = ::ResumeThread(h);
_ASSERTE(dwRet == 1);
At the top of your thread routine you should do something like:
BOOL ok = MyThread->HasStarted();
_ASSERTE(ok);
_ASSERTE(GetThread() == MyThread);
-Jan
This posting is provided "AS IS" with no warranties, and confers no
rights.
-----Original Message-----
From: Discussion of the Rotor Shared Source CLI implementation
[mailto:[EMAIL PROTECTED] On Behalf Of Hamnet
Sent: Wednesday, August 13, 2003 6:09 AM
To: [EMAIL PROTECTED]
Subject: [DOTNET-ROTOR] Create a Thread in Rotor's code
Hi everyone,
I am modifying the source code of fjit.cpp to create a thread that it
executes native code (generated by FJIT). Thread jumps correctly to
this code, but when it tries to execute the code corresponding to helper
gives an error of memory access violation. Concretely one is the call
to
the GetThread() function. The following scheme sample that is what
attempt
to do:
-----------------------------
void *myThread(...){
while (true){
while(not_active);
jumps_to_users_code;
}
}
-----------------------------
users_code:
.
.
call JIT_PoolGC()
.
.
-----------------------------
void JIT_PoolGC(){
Thread *thread = GetThread(); <- ERROR !!!
.
.
}
-----------------------------
Thread I create throught the call CreateThread(...) but I must to use
the
structures that sscli for the management of threads provides (structure
THREAD), since the error appears when it consults this structure. How
can
I do this? Where can I find information specifies?
Thank you and excuse my english...
Hamnet