ObjFW  Diff

Differences From Artifact [996f83c1ba]:

To Artifact [6992f1ccb5]:


1360
1361
1362
1363
1364
1365
1366
1367
1368
1369

1370
1371
1372
1373
1374
1375
1376
1377

1378
1379

1380

1381

1382
1383
1384
1385
1386
1387
1388
1389
1390
1391






1392
1393
1394
1395
1396
1397
1398
{
	return blocking;
}

- (void)setBlocking: (BOOL)enable
{
#ifndef _WIN32
	int flags;

	blocking = enable;


	if ((flags = fcntl([self fileDescriptor], F_GETFL)) == -1)
		@throw [OFSetOptionFailedException
		    exceptionWithClass: [self class]
				stream: self];

	if (enable)
		flags &= ~O_NONBLOCK;

	else
		flags |= O_NONBLOCK;



	if (fcntl([self fileDescriptor], F_SETFL, flags) == -1)

		@throw [OFSetOptionFailedException
		    exceptionWithClass: [self class]
				stream: self];
#else
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
#endif
}

- (int)fileDescriptor






{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (void)close
{







|

|
>

|




|
|
>
|
|
>
|
>
|
>









|
>
>
>
>
>
>







1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
{
	return blocking;
}

- (void)setBlocking: (BOOL)enable
{
#ifndef _WIN32
	int readFlags, writeFlags;

	readFlags = fcntl([self fileDescriptorForReading], F_GETFL);
	writeFlags = fcntl([self fileDescriptorForWriting], F_GETFL);

	if (readFlags == -1 || writeFlags == -1)
		@throw [OFSetOptionFailedException
		    exceptionWithClass: [self class]
				stream: self];

	if (enable) {
		readFlags &= ~O_NONBLOCK;
		writeFlags &= ~O_NONBLOCK;
	} else {
		readFlags |= O_NONBLOCK;
		writeFlags |= O_NONBLOCK;
	}

	if (fcntl([self fileDescriptorForReading], F_SETFL, readFlags) == -1 ||
	    fcntl([self fileDescriptorForWriting], F_SETFL, writeFlags) == -1)
		@throw [OFSetOptionFailedException
		    exceptionWithClass: [self class]
				stream: self];
#else
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
#endif
}

- (int)fileDescriptorForReading
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (int)fileDescriptorForWriting
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (void)close
{