android 消息队列如何使用
内容如下:
#ifndef __MQ_H
#define __MQ_H
#ifdef __cplusplus
extern "C" {
#endif
/** A message. */
typedef struct MqMessage MqMessage;
/** A destination to which messages can be sent. */
typedef struct MqDestination MqDestination;
/* Array of bytes. */
typedef struct MqBytes MqBytes;
/**
* Hears messages.
*
* @param destination to which the message was sent
* @param message the message to hear
*/
typedef void MqMessageListener(MqDestination* destination, MqMessage* message);
/**
* Hears a destination close.
*
* @param destination that closed
*/
typedef void MqCloseListener(MqDestination* destination);
/** Message functions. */
/**
* Creates a new Message.
*
* @param header as defined by user
* @param body as defined by user
* @param replyTo destination to which replies should be sent, NULL if none
*/
MqMessage* mqCreateMessage(MqBytes header, MqBytes body,
MqDestination* replyTo);
/** Sends a message to a destination. */
void mqSendMessage(MqMessage* message, MqDestination* destination);
/** Destination functions. */
/**
* Creates a new destination. Acquires a reference implicitly.
*
* @param messageListener function to call when a message is recieved
* @param closeListener function to call when the destination closes
* @param userData user-specific data to associate with the destination.
* Retrieve using mqGetDestinationUserData().
*/
MqDestination* mqCreateDestination(MqMessageListener* messageListener,
MqCloseListener* closeListener, void* userData);
/**
* Gets user data which was associated with the given destination at
* construction time.
*
* It is only valid to call this function in the same process that the
* given destination was created in.
* This function returns a null pointer if you call it on a destination
* created in a remote process.
.....
我想知道的是如何在Android源码开发模式下使用该头文件提供的消息队列接口?编译链接时需要注意什么?
另:我比较奇怪的是,在这个头文件中没有struct MqMessage的定义,那么这个结构是在哪定义的?
相关推荐
安卓的消息队列机制
网上看到的关于消息队列的分析,总结得比较好
android消息队列
android应用程序开发 多线程通信 消息队列
android自定义消息队列
在android中使用消息对队列,实现的简单的开始,暂停功能
Android 消息队列模型详解及实例
Android 消息队列模型详解及实例 Android系统的消息队列和消息循环都是针对具体线程的,一个线程可以存在(当然也可以不存在)一个消息队列(Message Queue)和一个消息循环(Looper)。Android中除了UI线程(主线程),创建的工作线程默认是没有消息循环和消息队列的。如果想让该线程具有消息队列和消息循环,并具有消息处理机制,就需要在线程中首先调用Looper.prepare()来创建消息队列,然后调用Looper.loop()进入消息循环。如以下代码所示: class LooperThread extends Thread { public Handler m
android开发教程之使用looper处理消息队列
代码如下:package com.yanjun; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.Message; public class HandlerActivity extends Activity { @Override public void onCreate(Bundle savedInstanceS


