[Gambas-devel] Question about singleton class

Tobias Boege taboege at ...176...
Sat Sep 13 22:33:44 CEST 2014


On Sat, 13 Sep 2014, Tobias Boege wrote:
> On Sat, 13 Sep 2014, Tobias Boege wrote:
> > It is the same situation as assigning "h = Null". Do you think this should
> > keep the lock open, too? If you do, there is one thing you can do about it.
> > You can define your very personal lock class which will never close the
> > accompanying fd, even if the lock object is destroyed. The only way you
> > would close the fd is by an invocation of the Unlock instruction. Your last
> > question below sort of goes into this direction, but you can't implement
> > Lock and Unlock handlers in Gambas classes, so you would provide respective
> > Lock()/Unlock() methods from your class or write your own native component.
> > 
> 
> Or an even better way would be to add a static "Locks" class. This acts like
> an array for all your locks, so they are always referenced and never closed.
> 

The attached project shows what I mean. There you have to pay zero attention
to your lock variables.

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SystemwideSingleton-0.0.11.tar.gz
Type: application/octet-stream
Size: 4862 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/devel/attachments/20140913/fbe2a218/attachment.obj>


More information about the Devel mailing list