Skip to content

Commit

Permalink
#26 In Progress (Introduced new parameter for this special use case)
Browse files Browse the repository at this point in the history
  • Loading branch information
vpmedia committed Jul 1, 2014
1 parent 5e52671 commit 294c54f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions posix/CModule.as
Original file line number Diff line number Diff line change
Expand Up @@ -1476,8 +1476,9 @@ public class CModule
* @param args A vector of Strings that are used to fill the argv array given to main. The first String is typically used to specify the name of the application.
* @param env A vector of Strings that are used to populate the environment variables accesible by <code>getenv()</code>. There should be an even number of Strings in this Vector as they are treated as name/value pairs.
* @param preserveStack Inidcates whether the C stack should be preserved after the call to <code>__start1</code>. If this is set to false the stack depth will return to the value when start() was called upon return.
* @param isAutoSetRealThreadId Inidcates whether the module should auto-set its real thread id. Use false when using multi-threaded SWCs.
*/
public static function startAsync(console:Object = null, args:Vector.<String> = null, env:Vector.<String> = null, preserveStack:Boolean = true):void
public static function startAsync(console:Object = null, args:Vector.<String> = null, env:Vector.<String> = null, preserveStack:Boolean = true, isAutoSetRealThreadId:Boolean = true):void
{
CONFIG::debug { trace("CModule::startAsync: " + arguments); }

Expand All @@ -1491,9 +1492,11 @@ public class CModule
env = new Vector.<String>

// try to set us as the ui thread
/*try {
C_Run.workerClass["current"].setSharedProperty("flascc.uiThread.threadId", realThreadId);
} catch(e:*) {}*/
if(isAutoSetRealThreadId) {
try {
C_Run.workerClass["current"].setSharedProperty("flascc.uiThread.threadId", realThreadId);
} catch(e:*) {}
}
try {
CModule.start(console, args, env, preserveStack);
} catch(e:GoingAsync) {
Expand Down Expand Up @@ -1582,7 +1585,7 @@ public class CModule
// set up worker init stuff
workerInits.push(function(worker:*):void
{
CONFIG::debug { trace("CModule::workerInit: " + threadId); }
CONFIG::debug { trace("CModule::workerInit: " + threadId + " / " + realThreadId); }
prepForThreadedExec();

var v:Vector.<CModule> = getModuleVector();
Expand Down
2 changes: 1 addition & 1 deletion samples/09_Pthreads/pthread_swc.as
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ package
if(runMainBg && CModule.canUseWorkers) // start in bg if we have workers
CModule.startBackground(this, new <String>[], new <String>[])
else
CModule.startAsync(this)
CModule.startAsync(this, null, null, true, false)
}
catch(e:*)
{
Expand Down

0 comments on commit 294c54f

Please sign in to comment.