Question: i've a problem...

I need this:

Create a new thread, and pause it (waiting for a notification from the MainThread ) .
In the MainThread pull a trigger to resume this background thread.

In MainThread:

```
[NSThread detachNewThreadSelector:@selector(startTheBackgroundJob:) toTarget:self withObject:nil];

```

In background thread:

```
- (void) startTheBackgroundJob {
    @autoreleasepool {

        NSLog(@"+ Thread %@ started and waiting.", self.identifier);
        // Pause Here
        NSLog(@"- Thread %@ unlocked", self.identifier);

        [Scheduler doneTransaction: self];
    }
}

```

MainThread:

```
- (void) unlock {
    // resume a background thread
}

```

I've tried NSLock, NSConditionLock and Semaphore GCD....

Answer: 
I don't think you should do this. You should instead, pass the value into the directive. However, if you really feel like you need to do it, it does work fine: [fiddle](http://jsfiddle.net/NnkeP/2/).

HTML:

```
    <div ng-app="myApp">

        <div ng-controller="MyCtrl">
          Hello, {{name}}!
        </div>
        <introduction> </introduction>
        <note></note>
        <thing></thing>
        <notAThing></notAThing>
    </div>

```

JS:

```
    var myApp = angular.module('myApp',[]);

    var dirs = ['note', 'introduction', 'thing'];

    angular.forEach(dirs, function(dir) {
        myApp.directive(dir, function() {
            return {
                restrict: 'E',
                transclude: true,
                template: '<div class="' + dir + '">something</div>'
            }
        });
    });

```
I gotta say this may be the noob in me talking but I don't really see a major problem with this if you know what you're doing:

```
(function() {
  var createDirective, module, pluginName, _i, _len, _ref;

  module = angular.module('FacebookPluginDirectives', []);

  createDirective = function(name) {
    return module.directive(name, function() {
      return {
        restrict: 'C',
        link: function(scope, element, attributes) {
          return typeof FB !== "undefined" && FB !== null ? FB.XFBML.parse(element.parent()[0]) : void 0;
        }
      };
    });
  };

  _ref = ['fbActivity', 'fbComments', 'fbFacepile', 'fbLike', 'fbLikeBox', 'fbLiveStream', 'fbLoginButton', 'fbName', 'fbProfilePic', 'fbRecommendations'];
  for (_i = 0, _len = _ref.length; _i < _len; _i++) {
    pluginName = _ref[_i];
    createDirective(pluginName);
  }

}).call(this);

```

^ this is not my code btw just something I picked up and has worked for me. The way this works out is if you have the class set to any of the values in the array then it will attempt to have the facebook javascript parse the node/element.