Jump to content

[SOLVED] Misunderstanding the Async class.


photo

Recommended Posts

Hi,

I have some trouble for do what I want with Async class.

I want create like 8 Async class and each async class can have a number of tasks to do, I try like that : 
 

int task(int jobsid, int taskid, string ean, string path, string output) {
  log.message("Thread (%d) Task(%d)\n",jobsid,taskid);

  float timer = clock();
  while ((clock() - timer) < 0.5);
  return 1;
}

int launch() {
  forloop(int i;8) {
    Async async = new Async();
    async.run("GeneratorThread::task",i,0,"","","");
    async.run("GeneratorThread::task",i,1,"","","");

    jobs.append(async);
  }
}

But I receive an error :

 

/Users/aliot/Actisku/engine/software/source/engine/utils/Stack.h:72: Type &Stack<Interpreter::State, 128>::top() [Type = Interpreter::State, Capacity = 128]: Assertion: 'depth >= 0 && "Stack::top(): stack underflow"'

Shutdown

 

I have some question because seems I am not understanding well the async class :

 

Should I wait the first run finish before call the second ?

The run is not pushing the call inside a queue ?

Is it possible to call async.run inside thread() Unigine, like for have a thread who looking if the Async finish for reassign a new task ??

 

Thanks 

 

Tony

 
Link to comment

Hi Anthony!

 

Looks like it's another bug with Async class. It crashes even on a single 'run' call. Inside it's supposed to queue calls and run them in a thread. Passed this bug to development team, thanks! :)

Link to comment

Hi, I just update the new SDK and I still have my trouble,

I have 4 Async for treat 364 Image, I have 91 task (run) for Async.

Seems treat all the images but I still have an error after generated all the Images : 

 

Unigine fatal error/Users/aliot/Desktop/actisku/engine/software/source/engine/utils/Stack.h:88: void Stack<Variable, 2048>::push(const Type &) [Type = Variable, Capacity = 2048]: Assertion: 'depth + 1 < Capacity && "Stack::push(): stack overflow"'Shutdown

Tony

Link to comment

If that can help, the crash reporter return : 

 

Thread 36 Crashed:
0   libsystem_kernel.dylib         0x00007fff8d48b866 __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff8d92835c pthread_kill + 92
2   libsystem_c.dylib             0x00007fff8684cb1a abort + 125
3   libUnigine_x64.dylib           0x0000000100013d1f signal_handler(int) + 255
4   libsystem_platform.dylib       0x00007fff898b15aa _sigtramp + 26
5   libUnigine_x64.dylib           0x00000001004b85ed Variable::set(Variable const&) + 13 (Variable.h:134)
6   libUnigine_x64.dylib           0x000000010004a4fb Unigine::ExternClassExport::run_function(void*, int, Interpreter*, Stack<Variable, 2048>&) const + 267 (UnigineInterpreter.cpp:250)
7   libUnigine_x64.dylib           0x000000010042900c Async::process() + 1212 (Stack.h:85)
8   libUnigine_x64.dylib           0x000000010049587c AsyncThread::process() + 28 (Library.cpp:2362)
9   libUnigine_x64.dylib           0x00000001008d90c0 Thread::thread_handler(void*) + 48 (Thread.cpp:95)
10  libsystem_pthread.dylib       0x00007fff8d927899 _pthread_body + 138
11  libsystem_pthread.dylib       0x00007fff8d92772a _pthread_start + 137
12  libsystem_pthread.dylib       0x00007fff8d92bfc9 thread_start + 13
Link to comment
×
×
  • Create New...