[M3devel] up-front initialization of mutex/conditionvariable?
Jay K
jay.krell at cornell.edu
Tue Dec 15 04:06:45 CET 2009
Is it possible to initialize mutexes and condition variables right away?
Instead of having the delayed initialization?
Mutex initialization is pretty fast on Windows, no syscall.
Having it be delayed like it is maybe isn't worthwhile.
As far as I know, the interface is just "NEW(MUTEX)" and the only that can run is, like, "constant field initializers", not calls to any code/"constructors". ?
I know there is the idiom NEW(T).init() but that is up to callers to adhere to.
Hm. I know Modula-3 was avoiding creating unnecessary language features, but in this case it seems maybe the wrong thing? Too late I guess.
In the pthread initialization, can we just copy from a statically initialized never used mutex? Or we must call pthread_mutex_init?
I think we must call pthread_mutex_init, at least if we are to call pthread_mutex_delete.
- Jay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091215/945f24f4/attachment-0001.html>
More information about the M3devel
mailing list