views:

73

answers:

0

I have the following situation:

  • Three tasks: A,B,C (Implemented as Workling workers)
  • Two user events (Calls of a controller method)

The tasks are triggered this way:

  1. The first user event triggers Task A and Task B.
  2. Then an optional user event can trigger Task C, but that task must not run until Task A and B are finished.

How can I enforce this chain of events?

One way would be to perform Task A and B at the beginning of Task C, but the user event triggering Task C might never happen, but Task A and B must be performed nevertheless.

In a "normal" program I'd have the whole arsenal of synchronization objects at my disposal (mutexes, semaphores, critical sections, ...). But what can I do here?

(If it matters, the Rails application will run on a Linux server and Workling is set up to use Starling)