send

Gamma: Version 4.0
Prev |  | Next

# `send`

`send` -- transmits expressions for evaluation.

## Syntax

    send (task, s_exp)

## Arguments

`task`

  A task descriptor as assigned to a `locate_task` call.

`s_exp`

  Any Gamma or Lisp expression.

## Returns

A result depending on the receiving task, which could include:

- `t` if the message was delivered successfully.

- `nil` if the message could not be delivered.

- An expression in the form: (error "error message") if there was an error. See `error`.

## Description

This function constructs an ASCII string representing the `s_exp` and transmits it via synchronous interprocess communication to the receiving `task`. The `task` processes the message and returns a result based on that processing. If the `task` is another Gamma process, the message will be interpreted as a Gamma expression and evaluated. The return value will be the result of that evaluation.

## Example

Task 1:

        Gamma> init_ipc ("a","a");
        t
        Gamma> tsk = locate_task("b",nil);
        #<Task:9751>
        Gamma> send(tsk, #princ("hello\n"));
        hello
        t
        Gamma> send_async(tsk, #princ(cos(5), "\n"));
        t
        Gamma> send(tsk, #princ("goodbye\n"));
        t
        Gamma>

Task 2:

        Gamma> init_ipc ("b","b");
        t
        Gamma> while(t) next_event();
        hello
        0.28366218546322624627
        goodbye

See the GTK: Preparing Plots section or the Common: Starting and Stopping the Cascade TextLogger section or the Common: Controlling the Cascade TextLogger section of the Log Functions chapter in the Cogent Tools Demo and Tutorials book for examples of this function used in context.

## See Also

`isend`, `locate_task`, `send_async`, `send_string`, `send_string_async`

Prev | Home | Next
`run_hooks` | Up | `send_async`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.