summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'file.c')
-rw-r--r--file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/file.c b/file.c
index 2aa896ae47..08cd5f8dcf 100644
--- a/file.c
+++ b/file.c
@@ -4200,6 +4200,7 @@ rb_file_flock(VALUE obj, VALUE operation)
{
rb_io_t *fptr;
int op[2], op1;
+ struct timeval time;
rb_secure(2);
op[1] = op1 = NUM2INT(operation);
@@ -4217,7 +4218,10 @@ rb_file_flock(VALUE obj, VALUE operation)
case EWOULDBLOCK:
#endif
if (op1 & LOCK_NB) return Qfalse;
- rb_thread_polling();
+
+ time.tv_sec = 0;
+ time.tv_usec = 100 * 1000; /* 0.1 sec */
+ rb_thread_wait_for(time);
rb_io_check_closed(fptr);
continue;