Re: How To Design A Queue of Messages?
Re: How To Design A Queue of Messages?
- Subject: Re: How To Design A Queue of Messages?
- From: Tommy Nordgren <email@hidden>
- Date: Sat, 10 Sep 2005 17:08:35 +0200
Sep 10, 2005 kl. 2:47 PM skrev Jerry Krinock:
I would like to make a first-in, first-out queue of tasks to be
performed.
The tasks are different messages to different objects. To me, the
natural
method is to somehow pack each task into an NSDictionary, and then
add it to
an NSMutableArray, which is my "queue".
Is it possible to do such a thing, or is there a better way? If
so, what
object(s) should/can I pass through the NSDictionary to represent
each task?
I've been trying NSInvocations and NSMethodSignatures in various
ways, but
to make a long story short, these things don't always seem to
behave like
normal objects, and I've not been able to make anything work.
My tasks/messages have no arguments and no return values, so that
should
simplify things a little. Also, it seems straightforward to manage
this
queue and schedule the tasks, if I can just get them in and out of
my queue!
Jerry Krinock
The easiest way to do this is probably to code this module in
Objective C++,
and use std::queue tmmplates, instantiated with a suitable enum.
Then when dequeuing the events, pass them to a suitable dispatch method,
that uses a standard C/c++/Objective C /Objective C++ switch
statement for
dispatching messages to the appropriate class.
This is very much the same method that an object oriented library
running
on classic used for dispatching events.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40chello.se
This email sent to email@hidden
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden