/*
* Copyright 2011, Tim Branyen @tbranyen
* @author Michael Robinson @codeofinterest
*
* Dual licensed under the MIT and GPL licenses.
*/
#include
#include
#include
#include "../vendor/libgit2/include/git2.h"
#include "../include/threads.h"
#include "../include/error.h"
using namespace v8;
using namespace node;
void GitThreads::Initialize(Handle target) {
HandleScope scope;
Local tpl = FunctionTemplate::New(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(String::NewSymbol("Threads"));
NODE_SET_PROTOTYPE_METHOD(tpl, "init", Init);
constructor_template = Persistent::New(tpl->GetFunction());
target->Set(String::NewSymbol("Threads"), constructor_template);
}
Handle GitThreads::New(const Arguments& args) {
HandleScope scope;
GitThreads *threads = new GitThreads();
threads->Wrap(args.This());
return scope.Close(args.This());
}
Handle GitThreads::Init(const Arguments& args) {
HandleScope scope;
int returnCode = git_threads_init();
if (returnCode) {
return GitError::WrapError(giterr_last());
}
return True();
}
Persistent GitThreads::constructor_template;