Skip to content

Commit

Permalink
my_file_opened to my_atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vojtovich committed Apr 15, 2020
1 parent 5876ed9 commit 10cdf52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mysys/my_fopen.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags)
{
if (my_file_info[Filedes].type != UNOPEN)
{
thread_safe_decrement32(&my_file_opened); /* File is opened with my_open ! */
/* File is opened with my_open ! */
my_atomic_add32_explicit(&my_file_opened, -1, MY_MEMORY_ORDER_RELAXED);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions mysys/my_open.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int my_close(File fd, myf MyFlags)
{
my_free(name);
}
thread_safe_decrement32(&my_file_opened);
my_atomic_add32_explicit(&my_file_opened, -1, MY_MEMORY_ORDER_RELAXED);
DBUG_RETURN(err);
} /* my_close */

Expand Down Expand Up @@ -133,7 +133,7 @@ File my_register_filename(File fd, const char *FileName, enum file_type
DBUG_ENTER("my_register_filename");
if ((int) fd >= MY_FILE_MIN)
{
thread_safe_increment32(&my_file_opened);
my_atomic_add32_explicit(&my_file_opened, 1, MY_MEMORY_ORDER_RELAXED);
if ((uint) fd >= my_file_limit)
DBUG_RETURN(fd);
my_file_info[fd].name = (char*) my_strdup(FileName, MyFlags);
Expand Down

0 comments on commit 10cdf52

Please sign in to comment.