Ignore:
Timestamp:
Apr 29, 2013, 7:32:19 PM (9 years ago)
Author:
katerina
Message:

Fix for ticket #338 (steady growth of memory usage).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/sh_fInotify.c

    r426 r433  
    130130    {
    131131      /* Init from main thread */
    132       sh.flag.inotify |= SH_INOTIFY_DOSCAN;
    133       sh.flag.inotify |= SH_INOTIFY_NEEDINIT;
     132      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN;   );
     133      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; );
    134134
    135135      if (0 == sh_pthread_create(sh_threaded_module_run, (void *)arg))
     
    154154      /* Reconfigure from main thread */
    155155      /* sh_fInotify_init_internal(); */
    156       sh.flag.inotify |= SH_INOTIFY_DOSCAN;
    157       sh.flag.inotify |= SH_INOTIFY_NEEDINIT;
     156      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN;   );
     157      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; );
    158158      return SH_MOD_THREAD;
    159159    }
     
    226226    {
    227227      count = 0; /* Re-expand glob patterns to discover added files. */
    228       sh.flag.inotify |= SH_INOTIFY_INSCAN;
     228      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN; );
    229229      sh_files_check_globFilePatterns();
    230       sh.flag.inotify &= ~SH_INOTIFY_INSCAN;
    231       sh.flag.inotify |= SH_INOTIFY_NEEDINIT;
     230      SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN;  );
     231      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; );
    232232    }
    233233
     
    396396   * DOSCAN is finished, hence wouldn't call init().
    397397   */
    398   sh.flag.inotify &= ~SH_INOTIFY_NEEDINIT;
     398  SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_NEEDINIT; );
    399399
    400400  return 0;
     
    474474  else if ((event->mask & IN_Q_OVERFLOW) != 0)
    475475    {
    476       sh.flag.inotify |= SH_INOTIFY_DOSCAN;
    477       sh.flag.inotify |= SH_INOTIFY_NEEDINIT;
     476      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_DOSCAN;   );
     477      SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; );
     478
    478479      SH_MUTEX_LOCK(mutex_thread_nolog);
    479480      sh_error_handle(SH_ERR_WARN, FIL__, __LINE__, event->wd, MSG_E_SUBGEN,
     
    639640          if (event->mask & IN_ISDIR)
    640641            {
    641               sh.flag.inotify |= SH_INOTIFY_INSCAN;
     642              SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_INSCAN;   );
    642643              sh_files_checkdir (classD, check_maskD, rdepthD,
    643644                                 path, (event->len > 0) ? event->name : NULL);
    644               sh.flag.inotify &= ~SH_INOTIFY_INSCAN;
    645               sh.flag.inotify |= SH_INOTIFY_NEEDINIT;
     645              SH_INOTIFY_IFUSED( sh.flag.inotify &= ~SH_INOTIFY_INSCAN;  );
     646              SH_INOTIFY_IFUSED( sh.flag.inotify |= SH_INOTIFY_NEEDINIT; );
    646647              sh_dirs_reset  ();
    647648              sh_files_reset ();
Note: See TracChangeset for help on using the changeset viewer.