Skip to content

Threading model #827

@joshaber

Description

@joshaber

👋

I've been plumbing the depths of nodegit to understand how all the pieces fit together. I'm a bit concerned about the threading model.

My understanding:

  1. We enqueue asynchronous work with Nan::AsyncQueueWorker.
  2. Nan::AsyncQueueWorker calls uv_queue_work.
  3. uv_queue_work enqueues the work on a threadpool.

This means:

  1. We could do work on multiple threads at once.
  2. libgit2 says its objects shouldn't be used across multiple threads at once.
  3. We could end up accessing the same objects across multiple threads at once, most often the repository object.
  4. Potential 💥, definite violation of libgit2's threading model.

Is my understanding correct? Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions