aqhome: more work on transformation to event2/ipc2.

This commit is contained in:
Martin Preuss
2025-02-27 14:08:44 +01:00
parent bebc4c1b0d
commit d887747b3c
45 changed files with 2446 additions and 287 deletions

View File

@@ -19,7 +19,7 @@ typedef struct AQH_EVENT_LOOP AQH_EVENT_LOOP;
AQHOME_API AQH_EVENT_LOOP *AQH_EventLoop_new(void);
AQHOME_API void AQH_EventLoop_free(AQH_EVENT_LOOP *eventLoop);
AQHOME_API void AQH_EventLoop_Run(AQH_EVENT_LOOP *eventLoop);
AQHOME_API void AQH_EventLoop_Run(AQH_EVENT_LOOP *eventLoop, int timeoutInMillisecs);
AQHOME_API void AQH_EventLoop_AddFdObject(AQH_EVENT_LOOP *eventLoop, AQH_OBJECT *o);
AQHOME_API void AQH_EventLoop_DelFdObject(AQH_EVENT_LOOP *eventLoop, AQH_OBJECT *o);

View File

@@ -39,7 +39,7 @@ static void _signalReadyFdObjects(AQH_OBJECT_LIST2 *ol);
* ------------------------------------------------------------------------------------------------
*/
void AQH_EventLoop_Run(AQH_EVENT_LOOP *eventLoop)
void AQH_EventLoop_Run(AQH_EVENT_LOOP *eventLoop, int timeoutInMillisecs)
{
fd_set fdRead;
fd_set fdWrite;
@@ -56,8 +56,8 @@ void AQH_EventLoop_Run(AQH_EVENT_LOOP *eventLoop)
if (highestFd>-1) {
struct timeval tv;
tv.tv_sec=0;
tv.tv_usec=200000;
tv.tv_sec=timeoutInMillisecs/1000;
tv.tv_usec=(timeoutInMillisecs%1000)*1000;
rv=select(highestFd+1, &fdRead, &fdWrite, NULL, &tv);
if (rv>0) {
/* some fds became active */

View File

@@ -168,7 +168,7 @@ int AQH_FdObject_Read(AQH_OBJECT *o, uint8_t *ptrBuffer, uint32_t lenBuffer)
}
else if (rv>0) {
/* data received */
DBG_ERROR(AQH_LOGDOMAIN, "Received %d bytes", (int) rv);
DBG_INFO(AQH_LOGDOMAIN, "Received %d bytes", (int) rv);
return (int) rv;
}
else {

View File

@@ -72,10 +72,9 @@ void AQH_Object_free(AQH_OBJECT *o)
{
if (o && o->refCount>0) {
if (--(o->refCount)==0) {
GWEN_INHERIT_FINI(AQH_OBJECT, o);
GWEN_LIST_FINI(AQH_OBJECT, o);
AQH_Link_List_free(o->linkList);
GWEN_LIST_FINI(AQH_OBJECT, o);
GWEN_INHERIT_FINI(AQH_OBJECT, o);
GWEN_FREE_OBJECT(o);
}

View File

@@ -21,6 +21,7 @@
#define AQH_OBJECT_FLAGS_ENABLED 0x80000000L
#define AQH_OBJECT_FLAGS_FIRE 0x40000000L
#define AQH_OBJECT_FLAGS_DELETE 0x20000000L
enum {