Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ////////////////// PARALLEL PROCESSING //////////////////
- include_shared( "sgspproc" );
- PPROC = pproc_create();
- /*
- STRING
- */
- job = PPROC.add_job( "
- text = _T.get( 'text' );
- for( i = 0; i < 10; ++i )
- {
- print( text );
- sleep( 20 );
- }
- _T.set( 'info', { error = 5, wat = 'really?' } );
- " );
- job.set( "text", "thread T W O\n" );
- job.start();
- for( i = 0; i < 10; ++i )
- {
- print( 'thread O N E\n' );
- sleep( 20 );
- }
- job.wait();
- printvar( job.get( 'info' ) );
- /*
- FUNCTION
- */
- function threadproc()
- {
- text = _T.get( 'text' );
- for( i = 0; i < 10; ++i )
- {
- print( text );
- sleep( 20 );
- }
- _T.set( 'info', { error = 5, wat = 'really?' } );
- }
- job = PPROC.add_job( threadproc );
- job.set( "text", "thread T W O\n" );
- job.start();
- for( i = 0; i < 10; ++i )
- {
- print( 'thread O N E\n' );
- sleep( 20 );
- }
- job.wait();
- printvar( job.get( 'info' ) );
- ///////////////////// OUTPUT ////////////////////////////
- SGSVM [SGScript v0.8.2]
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- thread T W O
- thread O N E
- thread O N E
- thread T W O
- thread T W O
- thread O N E
- thread O N E
- thread T W O
- thread T W O
- thread O N E
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- object (0064B9B8) [1] dict
- {
- error = int (5)
- wat = string [7] "really?"
- }
- thread O N E
- thread T W O
- thread T W O
- thread O N E
- thread O N E
- thread T W O
- thread T W O
- thread O N E
- thread T W O
- thread O N E
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- thread O N E
- thread T W O
- object (0064B958) [1] dict
- {
- error = int (5)
- wat = string [7] "really?"
- }
- /////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement