2014년 12월 5일 금요일

Thread and ScopedThread functions in mongo shell

I noticed those functions in tests https://github.com/mongodb/mongo/blob/365cca0c47566d192ca847f0b077cedef4b3430e/jstests/libs/parallelTester.js
Is there any documentation about it?

How to work with threads through mongo shell?
Can I share cursor in threads?
Do I need to lock variables if I share them in threads?

Here is copy-paste for github:
Thread = function(){
this.init.apply( this, arguments );
}
_threadInject( Thread.prototype );

ScopedThread = function() {
this.init.apply( this, arguments );
}
ScopedThread.prototype = new Thread( function() {} );
_scopedThreadInject( ScopedThread.prototype );



That code is part of the jstests for MongoDB. It's undocumented internal testing code that could change whenever and it's not intended to be something people use in the shell for multithreading. If you want to multithread access to the database, use an official driver in a language with multithreading support.



댓글 없음:

댓글 쓰기