The version 5.5.16 of SObjectizer core is released!

The main changes of v.5.5.16 are related to message chains:

new functions select for receiving and handling messages from several mchains;

for receiving and handling messages from several mchains; mchains now use MPMC queue inside and this allows to call receive or select for the same mchain from different threads in parallel;

or for the same mchain from different threads in parallel; new helper functions create_mchain and auto_close_* in conjunction with new helper function auto_join .

The full list of changes can be found in the corresponding Wiki section.

Some of new features can be seen in this simple example. Three threads generate random numbers and send them to output chains. The main thread reads these numbers from three chains via select functions. Read finishes when all output chains are closed by generator threads.

#include <so_5/all.hpp> #include <iostream> #include <random> using namespace std ; using namespace std :: chrono ; using namespace so_5 ; void uint_generator ( mchain_t ch , unsigned int values , unsigned int pause ) { // Chain must be closed at exit. auto ch_closer = auto_close_retain_content ( ch ); // Random numer generation stuff. default_random_engine rnd_dev ; uniform_int_distribution < unsigned int > values_rnd { 0 , 256 }; uniform_int_distribution < unsigned int > pauses_rnd { 5 , pause }; // Generation for random numbers with random pauses between them. for ( unsigned int i = 0 ; i != values ; ++ i ) { // New random value will be sent to output chain. send < unsigned int > ( ch , values_rnd ( rnd_dev )); this_thread :: sleep_for ( milliseconds { pauses_rnd ( rnd_dev )}); } } void demo ( environment_t & env ) { // Thread for random number generators. thread first , second , third ; // All threads must be joined at exit. auto thr_joiner = auto_join ( first , second , third ); // Output chains for generators. auto ch1 = create_mchain ( env ); auto ch2 = create_mchain ( env ); auto ch3 = create_mchain ( env ); // Generator threads can be launched. first = thread { uint_generator , ch1 , 20 , 20 }; second = thread { uint_generator , ch2 , 15 , 25 }; third = thread { uint_generator , ch3 , 10 , 30 }; // Receive numbers from generators. select ( from_all (), case_ ( ch1 , []( unsigned int i ) { cout << "first: " << i << endl ; }), case_ ( ch2 , []( unsigned int i ) { cout << "second: " << i << endl ; }), case_ ( ch3 , []( unsigned int i ) { cout << "third: " << i << endl ; })); } int main () { so_5 :: wrapped_env_t sobj ; demo ( sobj . environment ()); }

The v.5.5.16 can be downloaded from the corresponding Files section or can be checked out from Subversion repository and from mirror on GitHub.

The Files section has the following archives:

so-5.5.16 (zip, tar.gz, tar.xz) -- the source code of SObjectizer core (with samples sources and tests);

so-5.5.16--bin-msvs2015-x86 (zip) -- the full source code with 32-bit binaries for Windows (compiled using MS Visual Studio 2015 Express Update1);

so-5.5.16--bin-msvs2015-x86_amd64 (zip) -- the full source code with 64-bit binaries for Windows (compiled using MS Visual Studio 2015 Express Update1).

Please note that since v.5.5.10 there are no archives with Doxygen-generated docs and binaries created using MS Visual Studio 2013. Such kind of archives can be created and uploaded by request.