ukrbublik / shm-typed-array

IPC shared memory for NodeJs. Use as Buffer or TypedArray.
MIT License
71 stars 9 forks source link

fix warnings and errors compiling for node v12.0.0 #6

Closed trxcllnt closed 5 years ago

ukrbublik commented 5 years ago

Thanks for PR.

But with changes compiling for old versions of nodejs will fail. As now for CircleCI (configured for nodejs 4)

Btw do you think there can be use for this lib in Nodejs 12? Since it has threads and SharedArrayBuffer.

trxcllnt commented 5 years ago

@ukrbublik thanks for reviewing.

I'm not super familiar with nan nor older versions of v8, but I've encountered this problem in other libraries I PR'd yesterday too. I did a blanket find/replace for the value->ToX() methods, as mentioned in the nan doc on converters. If you have any ideas on what the fix should be, I'd be happy to make the changes.

You're right that node itself now has threads and SAB, but using posix shared memory still has advantages:

  1. posix shm is sometimes necessary for zero-copy interop with non-node systems (e.g. databases, other languages like python/OpenCL), it can be configured and tuned at the machine level, and VMs can use posix shared memory in Docker and cloud environments.
  2. Selfishly, I'd rather avoid rewriting existing, proven code if possible just to use node v12 :-)
trxcllnt commented 5 years ago

@ukrbublik ok! looks like ToChecked is an alias for FromJust, and using that method fixes the build errors.

ukrbublik commented 5 years ago

Thanks!