comparison gtk3/dw.c @ 2584:2acc7ba5dea0

Add HTIMER type and change dw_timer_() functions to use it. On existing platforms, HTIMER will be int for now allowing API backward compatibility. On new platforms, iOS and Android, these will be pointers to the timer objects. This allows simplifying the code paths on those platforms. May change it on other platforms such as Mac in a future major version.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 23 May 2021 21:39:25 +0000
parents 457c91634881
children 156ad91481eb
comparison
equal deleted inserted replaced
2583:1d2f5c4eccc5 2584:2acc7ba5dea0
12206 * sigfunc: The pointer to the function to be used as the callback. 12206 * sigfunc: The pointer to the function to be used as the callback.
12207 * data: User data to be passed to the handler function. 12207 * data: User data to be passed to the handler function.
12208 * Returns: 12208 * Returns:
12209 * Timer ID for use with dw_timer_disconnect(), 0 on error. 12209 * Timer ID for use with dw_timer_disconnect(), 0 on error.
12210 */ 12210 */
12211 int API dw_timer_connect(int interval, void *sigfunc, void *data) 12211 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data)
12212 { 12212 {
12213 int *tag, _locked_by_me = FALSE; 12213 int *tag, _locked_by_me = FALSE;
12214 char tmpbuf[31] = {0}; 12214 char tmpbuf[31] = {0};
12215 12215
12216 tag = calloc(1, sizeof(int)); 12216 tag = calloc(1, sizeof(int));
12228 /* 12228 /*
12229 * Removes timer callback. 12229 * Removes timer callback.
12230 * Parameters: 12230 * Parameters:
12231 * id: Timer ID returned by dw_timer_connect(). 12231 * id: Timer ID returned by dw_timer_connect().
12232 */ 12232 */
12233 void API dw_timer_disconnect(int id) 12233 void API dw_timer_disconnect(HTIMER id)
12234 { 12234 {
12235 int _locked_by_me = FALSE; 12235 int _locked_by_me = FALSE;
12236 char tmpbuf[31] = {0}; 12236 char tmpbuf[31] = {0};
12237 12237
12238 snprintf(tmpbuf, 30, "_dw_timer%d", id); 12238 snprintf(tmpbuf, 30, "_dw_timer%d", id);