[ROOT] RE:MOD_CINT: problem with Win32 version of

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Mon Jul 17 2000 - 12:23:22 MEST


Hello Yap,

Thank you for your message.

Making cint thread safe is really difficult. So, for Win32, you need
to find workaround. One way is to emurate pre-forking model in the
thread. I am not sure what information you need to pass from server loop
process to thread process. If it is not too much, this method can work.
Basically, you start separate MOD_CINT process in created thread and pass
common information. Then let cint run the script. 

Another way is to block your threads by following CINT API. First, you
create 4 functions to 1) check identity of thread, 2) store current thread
ID, 3) enter critical section, 4) leave critical section. Then you 
give pointer to those functions to G__SetCriticalSectionEnv() API.
If you use G__calc(char *expr) API, the thread will be protected.

void G__SetCrititalSectionEnv(int (*issamethread)()
                             ,void (*storelockthread)()
                             ,void (*entercs)()
                             ,void (*leavecs)()) ;
void G__LockCriticalSection();    // just as reference
void G__UnlockCriticalSection();  // just as reference

Drawback of this method is that 2nd thread waits until the first thread
finishs.

Thank you
Masaharu Goto

P.S.
 Rooters,

  If you have suggestion, please let us know.



>
>hi,
>
>firstly , i would like to thank you to make CINT freely available,
>recently i encounter a problem , which is caused by 
>CINT is not thread-safe,
>here is the scenario:
>
>i use a apache module to make cint act as a "server-side scripting language"
>in apache (like asp and jsp) : MOD_CINT, 
http://linux.medyatext.com.tr/apache/cint.html
>under Linux , the module works fine,
>but under WinNT/98 , Apache use "multithreading" instead of "pre-forking"
>model , and this causes error when mod_cint is handling more than one request
 
at
>the same time,
>according to \cint\demo\mthread\readme.txt
>cint is not multi thread safe,  how could i solve the problem ?
>the child thread which will call CINT is created by Apache main worker,
>how could i make it thead-safe ?
>do i need to rewrite all my custom function ?
>please provide a way to go, thank you in advance.
>
>
>yap
>



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET