[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CriticalSection in VisaulC++ in C



Dear all

I'm porting SPoC to Microsoft Visual C++. It seems like libraries
as well as TIMER now function. (I need this to replace
the transputer plug-in board in a new product where we want
occam code reuse).

It's all exclusively in the C domain. No C++.
In order to insert time ticks, I spawn a thread with the 
_beginthread macro. That thread mostly sleeps, but wakes up
to set new time and verify front of timer queue. If a waiting
process is AFTER, an event flag is signalled.

I should not have any race condition with the SPoC occam code,
hand-investigation "proves" this. Should I decide not to trust
this, would any of you know how a straight critical section
could be added in VC++'s C-world? In process.h I only have
semaphores, and I wouldn't want to semaphorize the rest of
SPoC. Any suggestions?

-- 
Oyvind
(------------------------------------------------------------------(
)       Oyvind Teig )          oyvind.teig@xxxxxxxxxxxx ) Tel: +47 )
( Navia Maritime AS (          oyvind.teig@xxxxxxxxxxxx ( 73581268 (
)    div. Autronica )                                   ) Fax: +47 )
(    7005 Trondheim (           http://www.autronica.no ( 73919320 (
)            Norway )                                   )          )
(------------------------------------------------------------------(
)                    http://www.autronica.no/pub/tech/rd/index.htm )
(------------------------------------------------------------------(