_fwrite_nolock_fwrite_nolock

将数据写入流,但不锁定线程。Writes data to a stream, without locking the thread.

语法Syntax

size_t _fwrite_nolock(
   const void *buffer,
   size_t size,
   size_t count,
   FILE *stream
);

参数Parameters

bufferbuffer
指向要写入的数据的指针。Pointer to the data to be written.

sizesize
项目大小(以字节为单位)。Item size in bytes.

countcount
要写入的项的最大数量。Maximum number of items to be written.

streamstream
指向文件结构的指针。Pointer to the FILE structure.

返回值Return Value

fwrite 相同。Same as fwrite.

备注Remarks

此函数是fwrite的非锁定版本。This function is a non-locking version of fwrite. 它与fwrite完全相同,只不过它不会受到其他线程的干扰。It is identical to fwrite except that it is not protected from interference by other threads. 它可能更快,因为它不会产生锁定其他线程的开销。It might be faster because it does not incur the overhead of locking out other threads. 仅在线程安全的上下文中使用此函数,如单线程应用程序或调用范围已处理线程隔离的区域。Use this function only in thread-safe contexts such as single-threaded applications or where the calling scope already handles thread isolation.

要求Requirements

函数Function 必需的标头Required header
_fwrite_nolock_fwrite_nolock <stdio.h><stdio.h>

有关更多兼容性信息,请参阅 兼容性For more compatibility information, see Compatibility.

示例Example

请参阅 fread 示例。See the example for fread.

请参阅See also

流 I/OStream I/O
freadfread
_write_write