Commit ff3ec356d03b88df8cd2f676acf2ed76e306341c

Authored by Perry Werneck
1 parent 9ca90668

Fixing performance issues.

Showing 2 changed files with 10 additions and 2 deletions   Show diff stats
src/core/wait.c
@@ -248,16 +248,22 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327 @@ -248,16 +248,22 @@ LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H327
248 // Timeout! The timer was destroyed. 248 // Timeout! The timer was destroyed.
249 debug("%s exits with ETIMEDOUT",__FUNCTION__); 249 debug("%s exits with ETIMEDOUT",__FUNCTION__);
250 errno = ETIMEDOUT; 250 errno = ETIMEDOUT;
251 - return (LIB3270_KEYBOARD_LOCK_STATE) hSession->kybdlock; 251 + break;
252 } 252 }
253 253
254 - if(lib3270_is_disconnected(hSession)) 254 + if(hSession->kybdlock == LIB3270_KL_NOT_CONNECTED)
255 { 255 {
256 errno = ENOTCONN; 256 errno = ENOTCONN;
257 break; 257 break;
258 } 258 }
259 259
260 if(KYBDLOCK_IS_OERR(hSession)) 260 if(KYBDLOCK_IS_OERR(hSession))
  261 + {
  262 + errno = EPERM;
  263 + break;
  264 + }
  265 +
  266 + if(hSession->kybdlock == LIB3270_KL_UNLOCKED)
261 break; 267 break;
262 268
263 debug("%s: Waiting",__FUNCTION__); 269 debug("%s: Waiting",__FUNCTION__);
src/include/lib3270/keyboard.h
@@ -66,6 +66,8 @@ @@ -66,6 +66,8 @@
66 * @param seconds Number of seconds to wait. 66 * @param seconds Number of seconds to wait.
67 * 67 *
68 * @return keyboard lock status. 68 * @return keyboard lock status.
  69 + *
  70 + * @retval LIB3270_KL_UNLOCKED Keyboard unlocked, acess ok.
69 */ 71 */
70 LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds); 72 LIB3270_EXPORT LIB3270_KEYBOARD_LOCK_STATE lib3270_wait_for_keyboard_unlock(H3270 *hSession, int seconds);
71 73