Browse files

The socket async read worker shuts down when it has no callbacks now.

  • Loading branch information...
1 parent c377aea commit 3b416b8eb8a9e9420229d1bc0b15dd1c39b6aa32 John committed Oct 26, 2012
Showing with 3 additions and 8 deletions.
  1. +3 −7 Socket.c
  2. +0 −1 Socket.h
View
10 Socket.c
@@ -403,12 +403,8 @@ void SAL_Socket_UnsetSocketCallback(SAL_Socket* socket) {
socket->ReadCallbackState = NULL;
AsyncLinkedList_Remove(&asyncSocketList, socket);
- }
-}
-/**
- * Clears all the registered callbacks.
- */
-void SAL_Socket_ClearCallbacks(void) {
- SAL_Socket_CallbackWorker_Shutdown();
+ if (AsyncLinkedList_GetCount(&asyncSocketList) == 0)
+ SAL_Socket_CallbackWorker_Shutdown();
+ }
}
View
1 Socket.h
@@ -37,6 +37,5 @@ public uint32 SAL_Socket_Read(SAL_Socket* socket, uint8* const buffer, const uin
public uint32 SAL_Socket_Write(SAL_Socket* socket, const uint8* const toWrite, const uint32 writeAmount);
public void SAL_Socket_SetReadCallback(SAL_Socket* socket, SAL_Socket_ReadCallback callback, void* const state);
public void SAL_Socket_UnsetSocketCallback(SAL_Socket* socket);
-public void SAL_Socket_ClearCallbacks(void);
#endif

0 comments on commit 3b416b8

Please sign in to comment.