Using pthread with LocalStorage or sqlite

I’ve been trying to save something using LocalStorage using pthread because it’s been blocking my gl thread. I’ve been getting EXC_BAD_ACCESS though. How can I do this?

Last few tracebacks I got were:
0 sqlite3VdbeExec
1 sqlite3_step
2 localStorageSetItem(char const**, char const**)

My code is pretty simple

void* _asyncSave(void *ptr) {
  MyClass *node = (MyClass *)ptr;
  node->save();
  return NULL;
}

void MyClass::asyncSave() {
  pthread_t thread;
  pthread_create(&thread, NULL, _asyncSave, this);
}

void MyClass::save() {
  // working save function
}