Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jan 2012
Offline Last Active Oct 01 2013 12:04 AM

Topics I've Started

Compiling in a seperate thread

14 December 2012 - 02:25 PM

My custom free function sometimes receives unknown pointers. Trying to track down the cause.
Cause is this background compilation.

I am building a module in a separate thread like this

thread t([]()
	    mod->AddSection("section", "void main(){}");
	    int r = mod->Build(); assert(r>=0);

Just this, no other thread building a module. There are no contexts created or used in this thread. During this thread work i do not execute any context on other threads.

I have read this

Two things i am not certain.
1. Do i still need to call asThreadCleanup end of this thread?
2. Is it safe to call GarbageCollector? Should i make sure both does not occur at the same time.
3. Maybe something else i am not thinking?

Thank you.

How to call script objects constructor?

05 December 2012 - 06:37 AM

asIScriptObject *obj = static_cast<asIScriptObject*>(engine->CreateUninitializedScriptObject(t->GetTypeId()));

//manually initialize object properties
//Call default constructor, but how?

That is what i want to do.

How do i call default constructor of an existing object?

asPEEK, HTML remote debugger

24 October 2012 - 02:06 PM


I made a remote debugger using websockets, with a silly name Posted Image
Console debugger wasn't cutting it anymore.

integration is quite painless.
runs in its own thread, my game had no fps drops.

this a about 2 weeks work. there are probably many unforeseen bugs.
everyone utilizes angelscript uniquely.

There is a windows binary demo in Downloads section.
Hope you like it.



Attached File  asPEEK.png   348.64KB   63 downloads

Context state change

23 October 2012 - 08:02 AM


I'm currently writing a remote debugger, which i plan to share with you soon.
I have peculiar problem,

during debug if application unprepares a context but do not release it, there is no easy way for the debugger to know if context state is changed.

like this:
script runs
client say stop at line 10 at section x
debugger stops context on line 10.
steps out till function scope end.
application Unprepares function
debugger is not aware of the change it still thinks its in debugging state.
never inform application that debugging is finished, and ignore all other line callbacks because it is already debugging.

i currently actively check if debugged context is unprepared in one of the threads.
which is wasting cpu cycles. that thread would normally be waiting for debug commands to arrive and wake to process them.

i considered these but good not enough,
- depend on application to inform when context is unprepared. This error prone and much greater work needed for debugger integration.
- Check state change when debugger become wakes up again. This happens when client send debug information, or a new lineback. This would cause awkward pause when a function execution is complete.

did you face a similar problem?
what was your solution?

Thank you.

Function release crash and wrong error message, maybe?

21 October 2012 - 02:11 PM


asIScriptFunction *func =  mod->GetFunctionByDecl("void main()");

It is an error message followed by a crash.

func shouldn't be released here, but i did it by mistake.
Error message says the opposite of what happens here.
GC cannot free an object type of '_builtin_function_', it is kept alive by the application.

i looked around the code for an extra func->AddRef() for hours.
Did i misinterpret this error message?
or is this a bug?

Thank you.