Hello,
The Labview Build in Semaphore is a "Software Semaphore" created with a simple Queue.
I would like to have a Semaphore which could be abble to manage exclusion between "Threads, Process, Compilation units".
Actualy, the build in Semaphore can't be taken twice by a same process, Thread, Compilation Unit, because it doesn't take in account the process which has tryed to take it.
You can easily test it by creating a simple VI which calls twice a "Semaphore take" ... you will "deadlock yourself" !
I would like to have a "One token Semaphore or MUTEX", which could be taken multiple times by the owning process.
My need was at the begining, to made an existing instrument driver to be thread safe ... without having to create a "Gaz factory" and to modify an existing application architecture !
So i started all the VI's of the instrument driver, with a "Take semaphore", and finished them with a "Release Semaphore" ...
But some of the VI's where called by others ... and then => DeadLock !!!!
The solution would be to place in an intellignet way the Take and the release ... but i am sure i will forgot some special cases ....
So the idea of a new "Process/Thread/Compilation Unit MUTEX".
The behaviour of the new Semaphore will be quite the same as the existing one, the only diffirence is that the owning process,thread or compilation unit, will have the right to take a Semaphore more than one time without creating a Deadlock.
I think that the behaviour i describe here, is the behaviour in most of the existing real time systems like WxWorks, IRMX, OS9 ...
It would be nice to have such a tool, in order to simplify The ressources exclusions !
Manu.net
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.