Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flash.events package #82

Open
12 of 13 tasks
zwetan opened this issue Mar 24, 2016 · 2 comments
Open
12 of 13 tasks

flash.events package #82

zwetan opened this issue Mar 24, 2016 · 2 comments
Labels
AVMGlue The Flash Platform API

Comments

@zwetan
Copy link
Member

zwetan commented Mar 24, 2016

Do a first draft implementation of the whole flash.events package
see for reference documentation

Goal

  • focus on the easy stuff
    eg. keep Event class as mock but implement all the child classes
  • for Event and EventDispatcher implementation
    do a very basic simple one, provide internal hooks
  • implementation in betalib

this is meta issue related to

@zwetan
Copy link
Member Author

zwetan commented Mar 24, 2016

once we have a native timer callback we should be able to create a non-blocking event loop

eg this is blocking

while( true )
{
    // event loop
}

// code not executed here

this should be non-blocking

function myEventLoop():void
{
    // event loop
}

Program.setTimerListener( 1, myEventLoop );

// code executed here

// ... addEventListener/removeEventListener/ native/internal events dispatch

// event loop kick-in at 1 sec

// ...

// event loop kick-in at 2 sec

// ... addEventListener/removeEventListener/ native/internal events dispatch

// event loop kick-in at 3 sec

// etc.

// program flow continue till exit()
// option to block and wait all events complete before exit

@zwetan zwetan added the AVMGlue The Flash Platform API label Mar 24, 2016
@zwetan zwetan mentioned this issue May 28, 2016
@zwetan
Copy link
Member Author

zwetan commented Feb 18, 2020

we have events working

a main interface shell.async.IEventLoop (probably will be renamed to ILoop
a basic Loop implementation

primordial worker run the MainLoop class
and child workers run the WorkerLoop class

main differences are things that the main worker can do that child workers can not do
for example

  • catching signals like SIGINT, SIGTERM, etc.
  • synchronising workers events
  • etc.

now the work is to find good balance to be able to spawn worker to do async tasks
but receive back events into the main worker

for ex: with flash.net.Socket
connect() spawn a worker that use BSD socket connect()in blocking mode
but in parallel we run a timers to implement the Socket.timeout behaviour

scenarios are

  • if connect happen, child worker notify main worker and the connect event is dispatched
  • if timeout kickin before connect happen, main worker terminate the child worker
    and another event is dispatched (? not sure yet, need to test with a simple AIR app in parallel)

at first, we might allow to create flash.net.Socket only from the main worker and not from child workers, TDB

focus is flash.filesystem and flash.net

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AVMGlue The Flash Platform API
Projects
None yet
Development

No branches or pull requests

1 participant