2008-11-29 19:12:17 +01:00
|
|
|
/****************************************************************************
|
2018-05-29 21:21:26 +02:00
|
|
|
* libs/libnx/nxmu/nx_eventnotify.c
|
2008-11-29 19:12:17 +01:00
|
|
|
*
|
2021-02-23 19:55:00 +01:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2008-11-29 19:12:17 +01:00
|
|
|
*
|
2021-02-23 19:55:00 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2008-11-29 19:12:17 +01:00
|
|
|
*
|
2021-02-23 19:55:00 +01:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2008-11-29 19:12:17 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <mqueue.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <debug.h>
|
|
|
|
|
2011-07-24 22:49:01 +02:00
|
|
|
#include <nuttx/nx/nx.h>
|
2013-12-29 15:48:06 +01:00
|
|
|
#include <nuttx/nx/nxmu.h>
|
2008-11-29 19:12:17 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: nx_eventnotify
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* Rather than calling nx_eventhandler periodically, the client may
|
|
|
|
* register to receive a signal when a server event is available. The
|
|
|
|
* client can then call nv_eventhandler() only when incoming events are
|
|
|
|
* available.
|
|
|
|
*
|
2021-02-23 20:23:56 +01:00
|
|
|
* Only one such event is issued. Upon receipt of the signal, if the
|
|
|
|
* client wishes further notifications, it must call nx_eventnotify again.
|
2008-11-29 21:26:18 +01:00
|
|
|
*
|
2008-11-29 19:12:17 +01:00
|
|
|
* Input Parameters:
|
|
|
|
* handle - the handle returned by nx_connect
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2008-11-29 19:12:17 +01:00
|
|
|
* OK: No errors occurred. If CONFIG_NX_BLOCKING is defined, then
|
|
|
|
* one or more server message was processed.
|
|
|
|
* ERROR: An error occurred and errno has been set appropriately
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
int nx_eventnotify(NXHANDLE handle, int signo)
|
|
|
|
{
|
2019-03-13 16:16:30 +01:00
|
|
|
FAR struct nxmu_conn_s *conn = (FAR struct nxmu_conn_s *)handle;
|
2008-11-29 19:12:17 +01:00
|
|
|
struct sigevent se;
|
|
|
|
|
|
|
|
se.sigev_notify = SIGEV_SIGNAL;
|
|
|
|
se.sigev_signo = signo;
|
|
|
|
se.sigev_value.sival_ptr = (FAR void *)handle;
|
|
|
|
|
|
|
|
return mq_notify(conn->crdmq, &se);
|
|
|
|
}
|