I am in @marak's camp here. You don't want locking. You don't want events 
either. Just like you want neither a drill nor a hammer; you want a picture 
hanging. Different walls use different tools (drill and anchor for masonry; 
hammer and nail for drywall and studs).

What you want is for one task to start when another is complete. In 
threads, the solution is locking; in node and an event-driven environment, 
the solution is having an event emitter and a callback.

eventEmitter.on("taskdone",function(){
  // get started on task B
});

On Wednesday, April 4, 2012 12:56:57 AM UTC+3, Marak Squires wrote:
>
> It's hard to judge from the thread, but I'm not sure you really want 
> "locking" here.
>
> It's probably better to have a distributed message bus and use the 
> EventEmitter pattern. Basically, use .on and .emit to ensure that one task 
> won't fire until the "im complete" event is emitted from another actor.
>
> I'm bias, but https://github.com/hookio/hook.io might help. Maybe not!
>
> :-)
>
> On Tue, Apr 3, 2012 at 11:46 AM, Arunoda Susiripala <
> [email protected]> wrote:
>
>> @ billywhizz
>> I think I might need to run it across different machine. So central 
>> locking will needed.
>>
>> @ *Alexey*
>> Message Queue is quite interesting. I never thought of that. 
>>
>> On Wed, Apr 4, 2012 at 12:11 AM, Alexey Petrushin <
>> [email protected]> wrote:
>>
>>> Maybe it's worth to use message queue and not start next task until 
>>>> previous is finished and removed? 
>>>>
>>>  -- 
>>> Job Board: http://jobs.nodejs.org/
>>> Posting guidelines: 
>>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>>> You received this message because you are subscribed to the Google
>>> Groups "nodejs" group.
>>> To post to this group, send email to [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> For more options, visit this group at
>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>
>>
>>
>>
>> -- 
>> Arunoda Susiripala
>>
>> @arunoda <http://twitter.com/arunoda>
>>  <http://gplus.to/arunoda>https://github.com/arunoda
>> http://www.linkedin.com/in/arunoda
>>
>>  -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>
>
>
>
> -- 
> -- 
> Marak Squires
> Co-founder and Chief Evangelist
> Nodejitsu, Inc.
> [email protected]
>
>  

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to