Skip to content

SDLx::Queue #154

Open
kthakore opened this Issue Jul 26, 2011 · 2 comments

1 participant

@kthakore
PerlGameDev member

A simple module that would enqueue user events in a different queue then the regular events, meaning they would only be captured by the loop requesting this specific events.

It's important that even if the main sdl loop is faster then the auxiliary loop (that runs in a different thread), the queued events should not be captured by a different loop than the loop expecting for them.

The API could be something like (inspired by Thread::Queue):

# adds a new event in the queue
SDLx::Queue::enqeue($queue_name, $event)

# fetches the next event from the queue in blocking mode
SDLx::Queue::dequeue($queue_name)

# fetches the next event from the queue in non-blocking mode
SDLx::Queue::dequeue_non_blocking($queue_name)

# are there any pending events in this queue?
SDLx::Queue::pending($queue_name);

The queue could be an object, but making it a regular unblessed string makes it easier for sharing between threads.

The $event information should be serialized with Storable::freeze in order to avoid becoming undef as it is migrated to a different thread.

@kthakore kthakore was assigned Jul 26, 2011
@kthakore
PerlGameDev member

Author: froggs
Time: 1282826250
Field: milestone
Value: 2.520

@kthakore
PerlGameDev member

Author: froggs
Time: 1282826250
Field: comment
Value:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.