Re: Thread-safety and lazy-initialization of libraries

2014-07-01 Thread Sean Kelly via Digitalmars-d-learn
On Monday, 30 June 2014 at 20:53:25 UTC, Sergey Protko wrote: Is there any proper way to do on-demand lazy-initialization of used library, which will be also thread-safe? How do i need to handle cases where some methods, which requires library to be initialized, called from different threads

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Ali Çehreli via Digitalmars-d-learn
On 06/30/2014 03:46 PM, Ali Çehreli wrote: https://www.youtube.com/watch?feature=player_detailpage&v=yMNMV9JlkcQ#t=1690 Unfortunately, he never published his slides. Here is the information about an article he wrote on the topic: http://forum.dlang.org/thread/pelhvaxwjzhehdjtp...@forum.dla

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Ali Çehreli via Digitalmars-d-learn
On 06/30/2014 01:53 PM, Sergey Protko wrote: The question is how to write thread-safe lazy-initialization of library. David Simcha's DConf 2013 presentation covers this question. At around minute 28: https://www.youtube.com/watch?feature=player_detailpage&v=yMNMV9JlkcQ#t=1690 Unfortunatel

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Sergey Protko via Digitalmars-d-learn
On Monday, 30 June 2014 at 21:55:56 UTC, H. S. Teoh via Digitalmars-d-learn wrote: On Mon, Jun 30, 2014 at 11:36:21PM +0200, Mike Wey via Digitalmars-d-learn wrote: On 06/30/2014 11:05 PM, bearophile wrote: >Sergey Protko: > >>libmpg123 has mpg123_init and mpg123_exit functions, which >>are not

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Sergey Protko via Digitalmars-d-learn
On Monday, 30 June 2014 at 21:36:10 UTC, Rene Zwanenburg wrote: On Monday, 30 June 2014 at 21:32:34 UTC, Sergey Protko wrote: On Monday, 30 June 2014 at 21:05:32 UTC, bearophile wrote: Sergey Protko: libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread H. S. Teoh via Digitalmars-d-learn
On Mon, Jun 30, 2014 at 11:36:21PM +0200, Mike Wey via Digitalmars-d-learn wrote: > On 06/30/2014 11:05 PM, bearophile wrote: > >Sergey Protko: > > > >>libmpg123 has mpg123_init and mpg123_exit functions, which are not > >>thread-safe, so we should to call them only once per process. Most > >>of u

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Rene Zwanenburg via Digitalmars-d-learn
On Monday, 30 June 2014 at 21:32:34 UTC, Sergey Protko wrote: On Monday, 30 June 2014 at 21:05:32 UTC, bearophile wrote: Sergey Protko: libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should to call them only once per process. Most of useful libraries als

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Mike Wey via Digitalmars-d-learn
On 06/30/2014 11:05 PM, bearophile wrote: Sergey Protko: libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should to call them only once per process. Most of useful libraries also has such stuff. But manual initialization is killing all beauty of high-level b

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Sergey Protko via Digitalmars-d-learn
On Monday, 30 June 2014 at 21:05:32 UTC, bearophile wrote: Sergey Protko: libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should to call them only once per process. Most of useful libraries also has such stuff. But manual initialization is killing all bea

Re: Thread-safety and lazy-initialization of libraries

2014-06-30 Thread bearophile via Digitalmars-d-learn
Sergey Protko: libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should to call them only once per process. Most of useful libraries also has such stuff. But manual initialization is killing all beauty of high-level bindings. I think module "static this"

Thread-safety and lazy-initialization of libraries

2014-06-30 Thread Sergey Protko via Digitalmars-d-learn
For some research i decided to write small high-level binding for libmpg123. The question is how to write thread-safe lazy-initialization of library. libmpg123 has mpg123_init and mpg123_exit functions, which are not thread-safe, so we should to call them only once per process. Most of usef