Anyone have any idea that I think a Samphar can create an array for each process in a simple way to consider it. Any better / more efficient implementation? OK, sorry for this people, I've found it after all. Here is the case that anyone is interested. barrier synchronization has been implemented internally? I'm guessing that this is using
semaphaurus , but I'm wondering how does it actually work, do anyone know?
class barrier (n: it) {emphasis (nacety; 1); Private Enough = 0; // Waiting for the number of procedures currently waiting for the private val wa = new semaphore; WaitSem.down Personal Val mutex = new semaphore; Def Sync = {Mute x Down; If (wait == N -1) {waitSem.up; } And {wait + = 1; Mutex.up; WaitSem.down; Wait until wait -1 = 1; If (wait == 0) mutex.up; And wait em.up; }}}
Comments
Post a Comment