digitalmars.D - Microsoft Comega language
- Jeroen van Bemmel (11/11) Oct 05 2004 Maybe some people here find this interesting:
- Ivan Senji (16/27) Oct 05 2004 Would this be the same as:
- someone somewhere.com (14/24) Oct 06 2004 The above is correct but not optimal, the compiler could optimize and e....
- Ivan Senji (8/33) Oct 06 2004 use a
- Lloyd Dupont (19/27) Oct 06 2004 I'm not that fluent in D, beside I think they play with stack and other
Maybe some people here find this interesting: http://research.microsoft.com/Comega/ in particular http://research.microsoft.com/Users/luca/Papers/Polyphony%20(TOPLAS).pdf describes some interesting constructs: 1. async PostEvent( EventData data ) { /* executed in separate thread */ } 2. public class Buffer { public String Get() & public async Put( string s ) { return s; /* Get synchronizes with Put, then this is executed */ } }
Oct 05 2004
"Jeroen van Bemmel" <someone somewhere.com> wrote in message news:cjv59a$ujl$1 digitaldaemon.com...Maybe some people here find this interesting: http://research.microsoft.com/Comega/ in particular http://research.microsoft.com/Users/luca/Papers/Polyphony%20(TOPLAS).pdf describes some interesting constructs: 1. async PostEvent( EventData data ) { /* executed in separate thread */ }Would this be the same as: void PostEvent( EventData data ) { void _PostEvent( EventData data ) { /* executed in separate thread */ } Thread t = new Thread(&_PostEvent); t.start(); } ?2. public class Buffer { public String Get() & public async Put( string s ) { return s; /* Get synchronizes with Put, then this is executed */ } }And if someone knows how the D code for this would look, please post it and i will try to add that to the list of syntax extensions i am working on.
Oct 05 2004
In article <ck03od$1kd7$1 digitaldaemon.com>, Ivan Senji says...Would this be the same as: void PostEvent( EventData data ) { void _PostEvent( EventData data ) { /* executed in separate thread */ } Thread t = new Thread(&_PostEvent); t.start(); }The above is correct but not optimal, the compiler could optimize and e.g. use a threadpool rather than creating a new thread each time. One could think of attributes that say which threadpool to use (other than 'default'), and some mechanism to declare which threadpools there are (and how many threads they contain) Something like: async( "ThreadPool1" ) PostEvent( /* params */ ) { .. } and a deployment descriptor like <deployment> <threadpool name="ThreadPool1" maxthreads="10" initialthreads="3"/> </deployment>
Oct 06 2004
<someone somewhere.com> wrote in message news:ck15mh$2m6k$1 digitaldaemon.com...In article <ck03od$1kd7$1 digitaldaemon.com>, Ivan Senji says...use aWould this be the same as: void PostEvent( EventData data ) { void _PostEvent( EventData data ) { /* executed in separate thread */ } Thread t = new Thread(&_PostEvent); t.start(); }The above is correct but not optimal, the compiler could optimize and e.g.threadpool rather than creating a new thread each time. One could think of attributes that say which threadpool to use (other than 'default'), andsomemechanism to declare which threadpools there are (and how many threadstheycontain)I don't want to make it optimal because i don't have time for it, i am just thinking about syntaxes that could be possible in D.Something like: async( "ThreadPool1" ) PostEvent( /* params */ ) { .. } and a deployment descriptor like <deployment> <threadpool name="ThreadPool1" maxthreads="10" initialthreads="3"/> </deployment>
Oct 06 2004
I'm not that fluent in D, beside I think they play with stack and other low-level things. anyway a pseudo-code doing that would looks like that: public class Buffer { public string Get() { string s = (string) queue.Pop(); return s; } public void Put(string s) { queue.Push(s); } // --- where queue: // 1. Push()/Pop() combination is thread safe // 2. Pop method wait until there is some data in it // 3. could be any kind of FIFO, LIFO, RandomOut collection Stack queue; }2. public class Buffer { public String Get() & public async Put( string s ) { return s; /* Get synchronizes with Put, then this is executed */ } }And if someone knows how the D code for this would look, please post it and i will try to add that to the list of syntax extensions i am working on.
Oct 06 2004