On 11/02/2020 13:05, Valerio Di Gregorio (vadigreg) via openssl-users wrote: > 1. ASYNC_pause_job() can wake up before write(). It will then block on > the read(), which is too bad in my single-threaded code. > 2. I fixed case 1 by making read() non-blocking, I then run > ASYNC_pause_job() again and again until write() is actually > performed. So now I hit another issue. Time between printf(“pause”) > and write() is ~100/200 milliseconds. However time between write() > and printf(“resume”) is usually ~4.5 seconds and this way too much. It's not clear from your description how your application starts the ASYNC job in the first place. Are you using libssl to do this, or does your application call ASYNC_start_job() directly? When your certificate validation code calls ASYNC_pause_job() control will return to your application. Control will not return until ASYNC_start_job() is called again. Depending on how you started the job in the first place this will either be due to your application explicitly calling ASYNC_start_job() directly, or (if it used libssl to start the job), then by recalling the I/O function that hit the pause originally. Once ASYNC_start_job() is invoked then context swap should happen immediately (so ~4.5 seconds would be totally unexpected). So please explain a little more about how your application starts the job, and how it monitors its progress in order to know when to resume. Matt > > > > Is there a reliable way (only when data is really ready) and a prompt > way (in order of micro/milli-seconds) to wake up from ASYNC_pause_job()? > > > > Many thanks, any help would be much appreciated. > > > > Kind Regards, > > Valerio Di Gregorio >