comparison os2/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 da058319f717
comparison
equal deleted inserted replaced
2583:1d2f5c4eccc5 2584:2acc7ba5dea0
13523 * sigfunc: The pointer to the function to be used as the callback. 13523 * sigfunc: The pointer to the function to be used as the callback.
13524 * data: User data to be passed to the handler function. 13524 * data: User data to be passed to the handler function.
13525 * Returns: 13525 * Returns:
13526 * Timer ID for use with dw_timer_disconnect(), 0 on error. 13526 * Timer ID for use with dw_timer_disconnect(), 0 on error.
13527 */ 13527 */
13528 int API dw_timer_connect(int interval, void *sigfunc, void *data) 13528 HTIMER API dw_timer_connect(int interval, void *sigfunc, void *data)
13529 { 13529 {
13530 if(sigfunc) 13530 if(sigfunc)
13531 { 13531 {
13532 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval); 13532 int timerid = WinStartTimer(dwhab, NULLHANDLE, 0, interval);
13533 13533
13543 /* 13543 /*
13544 * Removes timer callback. 13544 * Removes timer callback.
13545 * Parameters: 13545 * Parameters:
13546 * id: Timer ID returned by dw_timer_connect(). 13546 * id: Timer ID returned by dw_timer_connect().
13547 */ 13547 */
13548 void API dw_timer_disconnect(int id) 13548 void API dw_timer_disconnect(HTIMER id)
13549 { 13549 {
13550 SignalHandler *prev = NULL, *tmp = Root; 13550 SignalHandler *prev = NULL, *tmp = Root;
13551 13551
13552 /* 0 is an invalid timer ID */ 13552 /* 0 is an invalid timer ID */
13553 if(!id) 13553 if(!id)