1. task messaging

I believe i have task messaging done for task.e.

There's two message types var and queue.

Var is a single var that is overwritten on each send, it's useful for rapidly changing data that is written often and only the last write is valid. Also useful for a situation where a flag is set in a loop in another task, and you don't feel like testing for it already been sent (tho this eats cpu time).

Queue is accumulative. Writes to it are not overwritten, but stay in the queue until read. Msgs are stored in the order recieved, there's no prioritising system (till it's requested, along with a suggested implementation). These are useful for data that should be read by the task it's sent to. Each read deletes one queued msg. There is no command to read all msgs from one task.

Commonalty of both-

Anything you can put into an Eu object type can be a msg.

Both var and queue outlive the task that wrote them and the task that they are sent to. In this way, a task can end now, and it's (normally returned) msg read later. The msg can now be sent to any or all other tasks, not just returned to the parent process. Rather than memory filling up with msgs to dead tasks, any task can read them, and thereby clear them.

Both are used by specifying the source and the target task id atom. Only one source task id can be used (altho it is not required to be the real task_self()), but groups of target ids or from ids can be used like {1,2,6,9}.

Both accept "*" to read from all senders or send to all tasks. This broadcast mode does not read from or write to the sender's var or queue. It will return all non-empty vars, and the next non-empty queued msg. All "*" or multiple reads will return the form {{senderid,"foo"}} , even if only one msg is returned.

Specifically reading from or writing to the sender's var or queue is allowed.

Both return the sender id when multiple reads are requested.

Both return the following formats-
single read-
"foo"
multiple reads- {{senderid,"foo"},{senderid,"boo"}}

Requests for the code for evaluation and suggestions will be entertained.

[edited:Derek -> Now shows how to enter double braces {{}} as non=markup.]

useless

new topic     » topic index » view message » categorize

2. Re: task messaging

useless said...

[edited because of creole problems]

What was the problem? Can you give us code that you entered that didn't work?

Jeremy

new topic     » goto parent     » topic index » view message » categorize

3. Re: task messaging

jeremy said...
useless said...

[edited because of creole problems]

What was the problem? Can you give us code that you entered that didn't work?

I believe that the issue was that when using double braces, creole normally interprets this as an image link. If you need to enter them as normal text, the first of the two should be preceded with the tilde chacracter ~.

So to display {{Inside Double Braces}} you need to code ~{{Inside Double Braces}}

new topic     » goto parent     » topic index » view message » categorize

4. Re: task messaging

jeremy said...
useless said...

[edited because of creole problems]

What was the problem? Can you give us code that you entered that didn't work?

Jeremy

If i could remember it},{..

useless

new topic     » goto parent     » topic index » view message » categorize

5. Re: task messaging

useless said...
jeremy said...

What was the problem? Can you give us code that you entered that didn't work?

If i could remember it},{..

Ok, you should wrap Euphoria code in <eucode></eucode> tags, such as:

{{it},{.}} 

Jeremy

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu