Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

isolates: replace SLIST with ngx_queue_t

  • Loading branch information
bnoordhuis committed Dec 12, 2011
1 parent 274ea91 commit 4c1fcc66bcfaef987ac34a75018bb327224225a8
Showing with 12 additions and 747 deletions.
  1. +4 −0 deps/uv/include/uv-private/ngx-queue.h
  2. +6 −3 src/node_isolate.cc
  3. +2 −3 src/node_isolate.h
  4. +0 −741 src/queue.h
@@ -99,4 +99,8 @@ struct ngx_queue_s {
(type *) ((unsigned char *) q - offsetof(type, link))


#define ngx_queue_foreach(q, h) \
for ((q) = ngx_queue_head(h); (q) != (h); (q) = ngx_queue_next(q))


#endif /* _NGX_QUEUE_H_INCLUDED_ */
@@ -35,7 +35,7 @@ Isolate* Isolate::New(uv_loop_t* loop) {


Isolate::Isolate(uv_loop_t* loop) {
SLIST_INIT(&at_exit_callbacks_);
ngx_queue_init(&at_exit_callbacks_);
loop_ = loop;

v8_isolate_ = v8::Isolate::GetCurrent();
@@ -67,19 +67,22 @@ void Isolate::AtExit(AtExitCallback callback, void* arg) {
it->callback_ = callback;
it->arg_ = arg;

SLIST_INSERT_HEAD(&at_exit_callbacks_, it, entries_);
ngx_queue_insert_head(&at_exit_callbacks_, &it->at_exit_callbacks_);
}


void Isolate::Dispose() {
struct AtExitCallbackInfo* it;
ngx_queue_t* q;

NODE_ISOLATE_CHECK(this);

SLIST_FOREACH(it, &at_exit_callbacks_, entries_) {
ngx_queue_foreach(q, &at_exit_callbacks_) {
it = ngx_queue_data(q, struct AtExitCallbackInfo, at_exit_callbacks_);
it->callback_(it->arg_);
delete it;
}
ngx_queue_init(&at_exit_callbacks_);

assert(v8_context_->InContext());
v8_context_->Exit();
@@ -22,7 +22,6 @@
#ifndef SRC_NODE_ISOLATE_H_
#define SRC_NODE_ISOLATE_H_

#include "queue.h"
#include "v8.h"
#include "uv.h"
#include "node_vars.h"
@@ -81,12 +80,12 @@ class Isolate {
Isolate(uv_loop_t* loop);

struct AtExitCallbackInfo {
SLIST_ENTRY(AtExitCallbackInfo) entries_;
ngx_queue_t at_exit_callbacks_;
AtExitCallback callback_;
void* arg_;
};

SLIST_HEAD(AtExitCallbacks, AtExitCallbackInfo) at_exit_callbacks_;
ngx_queue_t at_exit_callbacks_;
v8::Persistent<v8::Context> v8_context_;
v8::Isolate* v8_isolate_;
uv_loop_t* loop_;

0 comments on commit 4c1fcc6

Please sign in to comment.
You can’t perform that action at this time.