Re: [Rstplib-users] Help: RSTP semaphores (again)
Status: Alpha
Brought to you by:
ralex
From: Alex R. <ar...@mr...> - 2007-05-16 08:59:40
|
On Tuesday, May 15, 2007 6:07 PM Pan Jieke asked: > ... what's the utility of those semaphores, such as, = STP_OUT_psos_init_semaphore, > STP_OUT_psos_close_semaphore, etc.? I realized that they were just = void functions > for doing nothing, may be I misunderstood the idea. Can anyone tell me = in which > situation it should be used and how?=20 Hello, RSTPLib is a library, that has to be linked into some process. The = architecture of this process depends on system environment and/or your = choice. If this process is not a "single thread" one, you must protect = shared resources (data base) from simultaneous usage by different = threads (race condition). Semaphores, mutexes, etc. are dedicated to = this purpose. I tried to make RSTPLib system independent as far as possible. So the = code contains calls to macros RSTP_CRITICAL_PATH_START and = RSTP_CRITICAL_PATH_END in relevant places. The definitions of these = macros, as I noted above, have to be system dependent. While RSTP = simulator runs under Linux and is a single thread process, you may see, = that in this case these macros are empty. In another environment you = must decide - do you want to have non-empty semaphores or not? In our = real bridges, running under pSOS, we must use semaphores. The functions = STP_OUT_psos_*** serve to this purposes and are part of the environment. = Our real routers run under Linux, and RSTP daemon (the same way as MSTP = daemon) are single thread process. Best regards, Alex |