int ct_distribute_msg( Ct_msgtype type, void * pData, size_t len );
A separate copy of the message will be delivered to every thread that is subscribed to messages of the specified type when the scheduler regains control. A thread may subscribe by calling ct_subscribe(), or cancel the subscription by calling ct_unsubscribe() or ct_unsubscribe_all().
If no threads are currently subscribed to the specified message type, Cheap Threads will silently discard the message.
If a thread is itself subscribed to the message it sends, it will be the last thread to receive the message.
It is also possible to call ct_distribute_msg() before the scheduler runs. In that case, before the first thread runs, the scheduler will deliver the message to every thread subscribed to the specified message type at that time -- including threads that were subscribed after the message was enqueued.
After the scheduler has finished, calling ct_send_msg() is possible but not useful, since there is neither a scheduler to deliver the message nor any threads to receive it. Such a call will also leak memory, unless the application later calls ct_clear() to recover it.